Display of Reports
In this topic, you can find information about how MYOB Acumatica displays reports that are created with the MYOB Acumatica Report Designer.
What a Report Is
Reports can be saved in files on disk, or in the UserReport table of the database of an MYOB Acumatica instance. (The UserReport table uses the file name of the report as a key and stores the schema of the report in XML format in the Xml column.)
The saved report can be published on an MYOB Acumatica site—that is, added to the site map and to any applicable workspaces so that the users can work with the report.
For details on creating reports with the MYOB Acumatica Report Designer, see the S130 Reporting: Inquiry, Report Writing, Dashboards training course.
- From a report form, which is added to the site map, when the user clicks the Run Report button on the form toolbar
- From a maintenance or entry form, when the user clicks the action button whose name is associated with the report name
How the Report Is Launched from the Report Form
http://localhost/AcumaticaDB/frames/ReportLauncher.aspx?id=YF123456.rpx&HideScript=On
The ReportLauncher.aspx page contains the PXReportViewer control, whose JavaScript objects and functions are designed to obtain the report data and display the data on the form, and the PXSoapDataSource control, which is used to retrieve data for the report.
- Loads the report schema from the file on disk or from the database (by using the LoadReport method) to a PX.Reports.Controls.Report object (which stores the report schema in memory and provides the methods for working with this schema).
- If the report schema is loaded successfully, performs the following:
- Instantiates a PX.Reports.Web.WebReport object that will store data of the launched report and assigns an instance ID to WebReport.
- Binds the Report object to the data source that is specified by the PXSoapDataSource control of the ASPX page. The PX.Web.UI.PXSoapDataSource class instantiates a SoapNavigator object, which will be then used to retrieve data for the report from the database.
The server returns an XML response with the report parameters to display and with the ID of the instance of WebReport in the session. The browser displays the report parameters and other options on the report form.
How the Report Data Is Retrieved
http://localhost/AcumaticaDB/PX.ReportViewer.axd?
InstanceID=10bf4a13a38c4af39cafc80926e407f2&OpType=Report
&PageIndex=0&Refresh=True
To process the request, the server invokes the Render method of the WebReport class, which launches the generation of the report as a long-running operation in a separate thread.
To retrieve the data of the report from the database, the system uses the PX.Data.Reports.SoapNavigator object (to which a reference is stored in the Report object). SoapNavigator instantiates a PXGraph object (without a type parameter) and composes a BQL command as an instance of the PX.Data.Reports.BqlSoapCommand class. BqlSoapCommand inherits from the PX.Data.BqlCommand class and is optimized for retrieving data for the reports. BqlSoapCommand has the IndexReportFields method, which uses the PX.Data.PXDependsOnFieldsAttribute attribute to get the dependent fields of the report recursively. For details on how BQL commands are used to retrieve data from the database, see Translation of a BQL Command to SQL.
The system processes the data and creates a ReportNode object. That is, the system creates the sections of the report based on the data retrieved from the database and on the report schema from the Report object, and calculates all formulas inside the sections. Then the system uses the resulting ReportNode object, which contains all sections with all needed values, to render data in the needed format.
How the Report Data Is Displayed
After the long-running operation has completed, the PXReportViewer control displays the report on the report form.
http://localhost/AcumaticaERP/PX.ReportViewer.axd?
InstanceID=008f2a8afb1a4998ade98bc64fc30ad9&OpType=Report
&PageIndex=0
http://localhost/AcumaticaERP/PX.ReportViewer.axd?
InstanceID=008f2a8afb1a4998ade98bc64fc30ad9&OpType=PdfReport&Refresh=True
If a user turns the pages of the report or changes the format of the report, the system creates the results of the report from the ReportNode object stored in the session by using the renderer for the needed format. That is, the system does not retrieve the data of the report from the database and does not processes this data to create a ReportNode object once again.
How the Report Is Launched from the Maintenance or Entry Form
On a form, when a user clicks the action button to generate a report, the data source control of the form creates a request to the MYOB Acumatica server to execute the action delegate defined for the button. The server creates an instance of the graph, which provides the business logic for the form and invokes the action delegate method. The action delegate obtains from the form the data required to define the report parameters and throws an exception of the PX.Data.PXReportRequiredException type with the report ID and these parameters. The system processes the exception, saves the report parameters to the session, and redirects the user to the ReportLauncher.aspx page.
The ReportLauncher.aspx page loads the report schema and instantiates a WebReport object, as described in How the Report Is Launched from the Report Form. Instead of retrieving the values of report parameters from the webpage, the system opens the report with the parameters stored in the session. The system retrieves data for the report, as described in How the Report Data Is Retrieved.