[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: how to create array and print output in header
Hi Joe,
Basically the begin-heading section is called after
the page(body of the report) has been printed...
all the variables can be accessed in the header
section ... even with the arrays.(but i didnt try any
time...)
test this crude method ...
in the detail section where you print the report body
use this code
if #current-line = 1
do print-heading !(same code as begin-heading)
else
if #current-line = 45 !basically last line
new-page
end-if
end-if
copy the code in begin-heading to procedure
print-heading.
this should do the same work ...
take care and good luck
Laxman
--- Joe <jej1216@YAHOO.COM> wrote:
> I am having trouble with printing the contents of an
> array to a header.
>
> My rough (and I DO mean rough) code:
>
> Begin-Setup
> #Define Max_TRCs 100
>
> Create-Array Name=TRCs Size= {MAX_TRCs}
> Field=TIME_RPTG_CD:Char -
> Field=TRC_DESCRSH:Char
> End-Setup
>
> BEGIN-PROGRAM
> let $First = 'Y'
> Let #i = 0
> DO Select_TRCs
> END-PROGRAM
>
> BEGIN-HEADING
> print 'TR Code Legend:' (+1, {col_30})
> let #i = 0
> While #i < {MAX_TRCs}
> Get $TIME_RPTG_CD $TRC_DESCRSH From TRCs
> (#i)
> Break
> Show '$TIME_RPTG_CD = ' $TIME_RPTG_CD
> Print $TIME_RPTG_CD (+1,{col_30})
> Show '$TRC_DESCRSH = ' $TRC_DESCRSH
> Print $TRC_DESCRSH (0,{col_32})
> End-While
> END_HEADING
>
> BEGIN-PROCEDURE Select_TRCs
> BEGIN-SELECT DISTINCT
> TL.TIME_RPTG_CD
> TL.DESCRSHORT
> add 1 to #i
> DO Update_Array
> FROM PS_TL_WRKGPTRC_TBL TL
> WHERE TL.TIME_RPTG_CD <> ''
> AND TL.EFFDT = (SELECT MAX(TL2.EFFDT)
> FROM PS_TL_WRKGPTRC_TBL TL2
> WHERE TL2.EFFDT = TL.EFFDT
> AND TL2.EFFDT <= '01/01/2001')
> ORDER BY TL.TIME_RPTG_CD, TL.DESCRSHORT
> END-SELECT
>
> End-procedure
>
> BEGIN-PROCEDURE Update_Array
>
> Let $Found = 'N'
> Let #j = 0
> While #j < {MAX_TRCs}
> Get $TIME_RPTG_CD From TRCs (#j)
> TIME_RPTG_CD
> If $TIME_RPTG_CD = ''
> Let #i=#j
> Put &TL.TIME_RPTG_CD into TRCs (#i)
> TIME_RPTG_CD
> Let $Found = 'Y'
> Else
> If &TL.TIME_RPTG_CD = $TIME_RPTG_CD
> Let #i=#j
> Let $Found = 'Y'
> Break
> End-If
> End-If
> Let #j=#j+1
> End-While
>
> END-PROCEDURE
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/