Use report functions

Completed

When developing a report, in the report triggers and functions, you can access a special variable called CurrReport. The CurrReport variable always points to the current report object and has the following functions:

  • CurrReport.SKIP

    • Use this function to skip the current record of the current data item. If a record is skipped, it isn't included in totals and it isn't printed.

    • Skipping a record in a report is slower than never reading it at all. Therefore, use filters as much as you can.

    • A typical situation where you can use SKIP is to retrieve records from a related table by using values in the current record to form a filter. If the values in the current record already indicate that records from the related table won't be retrieved, you don't have to perform this processing. You can use SKIP to avoid the processing.

  • CurrReport.BREAK - Use this function to skip the rest of the processing of the data item that is currently processing. The report resumes processing the next data item. All indented data items under the data item that caused the break are also skipped.

  • CurrReport.QUIT - This function skips the rest of the report; however, it isn't an error. It's a typical ending for a report. When you use the QUIT function, the report exits without committing changes that were made to the database during implementation. The OnPostReport trigger won't be called.

  • CurrReport.PREVIEW

    • Use this function to determine whether a report is printing in preview mode.

    • If you run a report in preview mode, and the CurrReport.PREVIEW function is called, then the Print and Save As functionality isn't available.

    • This function ensures that any functionality that depends on the CurrReport.PREVIEW function being FALSE is called correctly when doing the actual print. If you run a client report definition (RDLC) report layout in preview mode and don't call the CurrReport.PREVIEW function, then you can print from the Print Preview window.

The Report data type has other functions that you can use. For more information, see Report Data Type.

There are also many Report Events:

  • OnAfterDocumentPrintReady Event

    • Use the OnAfterDocumentSetupPrinters event to specify what happens when the user selects the Print action on a report request page.

    • The OnAfterDocumentPrintReady event is used to send a report to a target extension printer.

  • OnAfterDocumentReady Event

    • Use the OnAfterDocumentReady event to specify what happens when the user generates a report artifact by stream or file, from code or a request page action. The OnAfterDocumentReady event is used to enable document patching scenarios in the application or to copy the artifact to a different location during testing.

    • The event input is the report ID, a JSON collection with report runtime information and the generated document in an InStream. Use the documenttype JSON property to identify the data type stored in the DocumentStream parameter and act accordingly. The final result must be written to the TargetStream parameter and the parameter Success must be set to true if the modified stream is to be used in the platform. The content in the TargetStream is discarded if the Success parameter is false upon return from the procedure.

  • OnAfterIntermediateDocumentReady Event

    • Use the OnAfterIntermediateDocumentReady event to specify what happens when the user has generated an intermediate report artifact by stream or file, from code or a request page action. These files are typically Xml or Word files where they're generated in the specific process flows. The OnAfterIntermediateDocumentReady event is used to enable document patching scenarios in the application, or to copy the artifact to a different location during testing.

    • The event input is the report ID, a JSON collection with report runtime information and the generated document in an InStream. Use the documenttype JSON property to identify the data type stored in the DocumentStream parameter and act accordingly. The final result must be written to the TargetStream parameter and the parameter Success must be set to true if the modified stream is to be used in the platform. The content in the TargetStream is discarded if the Success parameter is false upon return from the procedure.

  • OnAfterSetupPrinters Event

    • Use the OnAfterSetupPrinters event to set up different printers that users can use to print reports. Users can set which printer to use on the Printer Selections page. By subscribing to this event, you create payloads for different printers. A payload specifies settings such as paper sizes, paper trays, and more.
  • OnCustomDocumentMergerEx Event

    • Use the OnCustomDocumentMergerEx event to specify what happens when the user has specified a custom report layout type that is to be rendered into an artifact in application code.