[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Creating/Printing/Clearing Arrays in SQR?



Here is a simple example of an array used to collect checking account history and print it.

The defining of the array:  (This array has a maximum 8000 entries possible) :

Create-Array
     Name=AcctHistory -
     Size=8000 -
     Field=CreateDt:char -
     Field=TranCode:number -
     Field=Description:char -
     Field=Amount:number -
     Field=CheckNo:number -
     Field=Reversal:number -
     Field=EffectBalance:char

****************************************************************************************************************************************
To populate the array, 'PUT' the variables into it in the same order they were defined in the 'Create-Array' statement and increase your arrayindex variable: 

Put     $CreateDt &TranCode $Description #Amount &CheckNo &Reversal $EffectBalance
        Into    AcctHistory(#ArrayIndex)
	
        Add 1 to #ArrayIndex
****************************************************************************************************************************************
To print the data, you can do it one of two ways, either 'GET' the data from the array and then individually print it: 

Get #TranCode #Reversal #TranAmount $CreateDt #CheckNo $Description $EffectBalance -
    From AcctHistory(#TranCount) -
        TranCode Reversal Amount CreateDt CheckNo Description EffectBalance

Print #TranAmount       (,50,) Edit '99,999,999.99'
Print #CheckNo            (,10,)  Edit '8888888888'

****************************************************************************************************************************************
OR, using the let variable, extract the data from the array and then print it.

Let #IntAmt             = AcctHistory.IntAmt(#ArrayIndex)  
Print #IntAmt            (,50,) Edit '99,999,999.99'

It's been a while since I have played with the arrays, but if I remember right, I had some grief attempting to print directly 
from the array.  So I pulled the data out of the array first and then printed and I had better luck.  

As for clearing the array, I never do.  If you keep the index running properly and record your max, there really is no need to since each new account would start over back at arrayindex of 1 and overwrite the old one.  I'm not sure of your specific application...that may not work for you.

If this prompts more questions, feel free to respond!!


----------
From:   Cys, Kent D.[SMTP:CYSKD@AUS0000P01.AUST.TDPRS.STATE.TX.US]
Sent:   Monday, September 30, 1996 4:56 PM
To:     Multiple recipients of list SQR-USERS
Subject:        Creating/Printing/Clearing Arrays in SQR?

Greetings Fellow SQR Users,

Anyone have any sample code on how to define and use an array in SQR?  The
example in the SQR3 User's Guide is sketchy at best.  A sample of defining ,
populating,  printing, and then clearing an array would be ideal.  Any help
would be greatly appreciated...Thanks!

Kent Cys

Unrecognized Data: application/ms-tnef