Limiting the query run time and number of records

There may be many records in a table on which you are to build a report. After you have generated the query and designed the rough report, you may only want to preview several lines of records for testing, in which case, you can take advantage of the two query properties - Maximum Rows and Maximum Duration which allow you to limit the run time and number of records, saving time and resources. Taking InvoiceReport.cls as an example:

  1. Click File > Open in JReport Designer.
  2. In the Open Report Set dialog, click the Browse button to open the catalog file SampleReports.cat in <install_root>\Demo\Reports\SampleReports, then open InvoiceReport.cls in the catalog.
  3. Adjust the Maximum Rows and Maximum Duration properties of the query Invoice on which the report is built to suitable levels. You can adjust the values in either of the following ways:

    Note: If you find that you are unable to edit the properties, make sure that you have unchecked the Forbid editing data object properties option in the Options dialog (File > Options > Catalog > Forbid editing data object properties).

    Here, modify the value of Maximum Rows to 10 and change the value of Maximum Duration to 1 second. This specifies the maximum elapsed time to be one second, and that within this duration no more than ten records will be fetched.

  4. View the report. You will find that only ten rows are fetched within one second.

Notes: