EndMultiReport - cWinReport2
Ends a linked multi-report
Type: Procedure
Syntax
Procedure EndMultiReport
Call Example
Send EndMultiReport
Description
Normally, a report object represents a single report. The report object may contain nested child reports but the outer report represents a single report that is printed or viewed as a single report. A method exists that allows the developer to create linked multi-reports. A multi-report lets you run a number of reports and have them represented as a single report - the report will appear in the viewer as a single report and the report will be printed as a single report job.
You create a multi-report by setting the pbMultiReports property to true, for all reports to be linked. The default value of this property is false. Setting this property to true, tells the report objects that they are part of a larger report and that a report should not be considered completed when it ends.
After the last report has been generated you must explicitly inform the report engine that the report is complete. You do this by sending the EndMultiReport to the last report. You must remember to send this message when the final report is completed.
Before starting a subsequent report (report 2, report 3, etc.) you should always check to make sure that the previous report was not canceled. You do this by checking the report's cancelled_state property. If a report is canceled, you will not need to send the EndMultiReport message.
When pbMultiReports is true, the AutoNew_Page_State determines how page breaks are handled on the subsequent linked reports (i.e., the reports that occur after the first report). If AutoNew_Page_state is true, the default, the linked report will be start on a new page. If false, the new report is printed on the same page as the previous report.
Object oMyReport1 is a cWinReport2
:
Set pbMultiReports to True
:
End_object
Object oMyReport2 is a cWinReport2
:
Set pbMultiReports to True
Set AutoNew_Page_State to True // new page when this report starts
:
End_object
Object oMyReport3 is a cWinReport2
:
Set pbMultiReports to True
Set AutoNew_Page_State to False // new page is not generated when this report starts
:
End_object
Function RunMyReport returns boolean
boolean bCancel
Send Run_Reports of oMyReport1
Get Cancelled_state of oMyReport1 to bCancel
// if report 1 not canceled, run the next report
If not bCancel begin
Send Run_Reports of oMyReport2
Get Cancelled_state of oMyReport2 to bCancel
// if report 2 not canceled, run the next report
If not bCancel begin
Send Run_Reports of oMyReport3
Get Cancelled_state of oMyReport3 to bCancel
If not bCancel begin
Send EndMultiReport of oMyReport3
end
end
end
function_return bCancel
End_Function
See Also