Navigation: Language Reference > 13 - Built-in Functions >====== ENDPAGE (force page overflow) ====== | |
ENDPAGE( report [, printfooters ] )
ENDPAGE | Forces page overflow. |
report | The label of a REPORT structure. |
printfooters | An integer constant or variable. If omitted or zero (0), this prints group footers by forcing a group BREAK (usually used to terminate a report for preview). If one (1), group BREAKs are left open and no group footers print (usually used during a continuing report). |
The ENDPAGE statement initiates page overflow and flushes the print engine's print structure buffer. If the REPORT has the PREVIEW attribute, this has the effect of ensuring that the entire report is available to view.
Example:
SomeReport PROCEDURE
WMFQue QUEUE !Queue to contain .WMF filenames
STRING(64)
END
NextEntry BYTE(1) !Queue entry counter variable
Report REPORT,PREVIEW(WMFQue) !Report with PREVIEW attribute
DetailOne DETAIL
!Report controls
END
END
ViewReport WINDOW('View Report'),AT(0,0,320,200),MAX,HVSCROLL
IMAGE(''),AT(0,0,320,180),USE(?ImageField)
BUTTON('View Next Page'),AT(0,180,60,20),USE(?NextPage),DEFAULT
BUTTON('Print Report'),AT(80,180,60,20),USE(?PrintReport)
BUTTON('Exit Without Printing'),AT(160,180,60,20),USE(?ExitReport)
END
CODE
OPEN(Report)
SET(SomeFile) !Code to generate the report
LOOP
NEXT(SomeFile)
IF ERRORCODE() = 33 THEN BREAK.
PRINT(DetailOne)
END
ENDPAGE(Report) !Flush the buffer
OPEN(ViewReport) !Open report preview window
GET(WMFQue,NextEntry) !Get first queue entry
?ImageField{PROP:text} = WMFQue !Load first report page
ACCEPT
CASE ACCEPTED()
OF ?NextPage
NextEntry += 1 !Increment entry counter
IF NextEntry > RECORDS(WMFQue) THEN CYCLE. !Check for end of report
GET(WMFQue,NextEntry) !Get next queue entry
?ImageField{PROP:text} = WMFQue !Load next report page
DISPLAY !and display it
OF ?PrintReport
Report{PROP:FlushPreview} = TRUE !Flush files to printer
BREAK !and exit procedure
OF ?ExitReport
BREAK !Exit procedure
END
END
CLOSE(ViewReport) !Close window
FREE(WMFQue) !Free the queue memory
CLOSE(Report) !Close report (deleting all .WMF files)
RETURN ! and return to caller
See Also: