>Hello,
>I am printing a large multi-page report (payroll receipts) which consists in one or two pages per employee. I need to print a variable (total ammount) in a fixed place in the last page only (this may be the first or second page of each employee). To print it in a fixed place, I need to put it inside the "page footer" band. However, if the employee has a two-page receipt, it is printed in both pages.
>
>What I need is some variable that holds the total no. of pages of each group. Does such variable exist? I have not been able to find it.
>
>Then, I would:
>- group by employee in the receipt form
>- set to reset page number to 1 within each group
>- put the totals in the page footer
>- put a "print when" in the total, asking for "_pageno=total_pages".
>
>Does "total pages" exist? Or can anybody give me some advice on this?
>
>Thanks in advance!
The method for this generally is to create a variable to hold the total pages, then run the report to "nothing" or to a file. Then get the total pages from _PAGENO and run the report again using this value. E.g.:
LOCAL TotalPages && or PRIVATE
TotalPages = 0 && Init it so the REPORT doesn't nuts
MyTempfile = SYS(2015) + ".txt"
REPORT FORM MyReportForm TO File (MyTempfile) NOCONSOLE
TotalPages = _PAGENO
REPORT FORM MyReportForm TO PRINTER (MyTempfile) NOCONSOLE && or PREVIEW etc.
DELETE FILE (MyTempfile)
This is just an example and your scenario may be more complicated, but it's the gist of how it can be done. There also may be better solutions and for a long report it takes twice as long of course.
Bill
William A. Caton III
Software Engineer
MAXIMUS
Atlanta, Ga.