Create a processing-only report

Completed

A processing-only report is a report object that does not print; rather, it only processes table data. Processing table data isn't limited to processing-only reports. Reports that print can also change records. This section also applies to those reports. You can specify a report to be processing-only by changing the ProcessingOnly property of the report object. The report will function as it's supposed to, but it won't generate printed output.

When the ProcessingOnly property is set, the Request page for the report changes slightly because the Print and Preview buttons are replaced with an OK button. The Schedule and Help buttons remain unchanged.

Request page for a processing-only report.

After you have set the ProcessingOnly property, use the following guidelines to develop processing-only reports:

  • Decide which tables are read. These tables are the data items.

  • Design the report so that most of the code goes into the OnAfterGetRecord trigger.

  • Use the INSERT or MODIFY functions in the tables, as appropriate.

  • Use a dialog to show progress to the user and let them cancel the report.

Advantages for using a report instead of a codeunit to process data are:

  • The request page functionality that lets the user select options and filters for data items is available in a report, but it's difficult to program in a codeunit.

  • The Report Dataset Designer helps you visualize the program implementation flow.

  • Instead of writing code to open tables and to retrieve records, you can use report data items to provide a declarative way to access data.

Processing-only reports have the advantage of built-in user interactivity by using the Request page. When the process requires user interactivity, select a processing-only report instead of a codeunit. Processing-only reports are also simpler to maintain because of the way that the data items visualize the flow of the code.

The following example shows a processing-only report.

report 50133 MyProcessingOnlyReport
{
    Caption = 'My ProcessingOnly Report';
    UsageCategory = ReportsAndAnalysis;
    ApplicationArea = All;
    AdditionalSearchTerms = 'My ProcessingOnly Report';
    ProcessingOnly = true;

    dataset
    {
        dataitem(Customer; Customer)
        {
            trigger OnPreDataItem()
            begin

            end;

            trigger OnAfterGetRecord()
            begin
                counter += 1;
            end;

            trigger OnPostDataItem()
            begin

            end;
        }
    }
    trigger OnInitReport()
    begin
        clear(counter);
    end;

    trigger OnPreReport()
    begin

    end;

    trigger OnPostReport()
    begin
        Message('Records Processed: %1 for: %2', counter, Customer.GetFilters());
    end;

    var
        counter: Integer;
}

This report loops over all customer records and displays a message with the number of records that were processed. If you apply filters in the request page, fewer records might be processed, which will be shown in the message, including the applied filters.