Limit the number of records per page
Use this procedure to limit the number of records shown on pages of a report.
This procedure demonstrates how the number of records shown in a report can be limited by means of conditional formatting. In particular, a formatting rule is applied to the Visible property of the Page Break control. In this example, the number of data rows is passed to the report as a parameter.
For details, see Report controls.
-
Create a new report or open
an existing one.
In this procedure, a table report is used as a starting point.
- To add a parameter to the report, in the Field List, right-click the Parameters section, and click Add Parameter.
-
For the new parameter, set property values as follows:
Property Value (Name) rowsNumber Parameter Type Int32 Description Rows per Page: -
From the Tool Box, drag the Page
Break control onto the report's Detail
band at the top of the detail table.
For details, see Report bands.
- For the new control, set the Visible property to No, and click the browse button (...) in the Formatting Rules property box to open the Formatting Rule Editor dialog box.
- Click the Edit Rule Sheet button to open the Formatting Rule Sheet Editor
- Click the add button (+), to create a new formatting rule.
-
Set The new rules Visible property to
Yes, and click the browse button
(...) in the Condition
property box to open the Condition Editor dialog box.
-
In the Condition Editor dialog box, define the following
expression for the rule:
- ([DataSource.CurrentRowIndex] % [Parameters.rowsNumber] == 0) And ([DataSource.CurrentRowIndex] != 0)
- Click OK to save the changes and close the dialog box, and then click Close to close the Formatting Rule Sheet Editor.
- In the Formatting Rules Editor, first select the new rule in the Available Rules box, then click the > button to move it to the Applied Rules box.
- Click OK to close the Formatting Rules Editor dialog box.
- The report is now ready. Switch to the Preview tab, and in the Parameters section, define the required value, and click Submit.