You can override the fetch method to filter the data that is displayed in a report. This override does not reduce the number of records that are returned by the query of the report. Instead it prevents some records from being sent to the final report. Each record is examined by the branching logic you add to the fetch method. Branching determines which records to give to the send method. Those records appear in the final report.
Do not call super() when you override the fetch method in a report.
By default, each record that is returned by the query appears in the report. To reduce the number of records returned, add range restrictions to the query. Report ranges are more efficient than overriding the fetchmethod; however, report ranges are less expressive. For information about adding ranges to queries, see Query Elements in the AOT.
The following code example loops through each record that is returned by the query. The code tests a field in each record and branches to a send method call for records that belong in the report.
In this example, the BankAccountTable table is the only data source for the report. The fetch method in the report is overridden with the following code.