OpenReport - cDRReport¶
Methods - Properties - Events
Method Type¶
Function
Return Type¶
Arguments¶
None
Description¶
Attempts to open the report specified in psReportName.
First, a test is performed to check if the filename stored in the psReportName property contains a path and exists. If the file does not exist, psReportPath is tested. If no file can be found and DataFlex 17.1 (or later) is used, the ReportsFolder method is called, and the returned value is tested. For DataFlex 17.0 or earlier, or if the report cannot be found, the psDataPath of the application workspace object will be queried to locate the report.
If the report cannot be found, an error will be returned.
When the property psReportId contains a value, the class attempts to close a report via CloseReport using that value as the ID.
OpenReport can be called directly in your code and will also be invoked when RunReport is executed. When OpenReport is successful, the report is opened, and the return value is the report ID, which is automatically stored in the property psReportId.
The OnInitializeReport event is triggered during OpenReport. This event can be used to set additional properties like psFilterFunction or psFunction.
In a Windows application, if pbShowStatusPanel is true and phoStatusPanel contains an object ID, a popup message is sent to the status panel object. This status panel can be used to inform the user about the report's loading progress.
The property pbCanceled can be set during initialization to cancel opening of the report.
The OpenReport method creates a COM instance of the report viewer; if the COM module is not properly registered, an error will be generated.
If the data source is the DataFlex embedded database and the property pbAutoLocateDFFile is true, OpenReport may change the paths of the tables and the database.
DataFlex Framework Usage¶
- Web
- Windows
- FlexTron
Sample¶
Object oReport is a cDRReport
Set psReportName to 'MyReport.dr'
Set peOutputDestination to PRINT_TO_FILE
End_Object
Object oRunReportButton is a Button
Set Label to 'Run Report'
Procedure OnClick
String sReportId
Get OpenReport of oReport to sReportId
If (sReportId <> '') Begin
Send Info_Box 'We have successfully opened a report'
Send OutputReport Of oReport
Send CloseReport Of oReport sReportId
End
End_Procedure
End_Object