Specifying the Select N condition

Sometimes, you may want to show data of certain range in a group or some groups in a table. To achieve this, you can use the Select N feature. By specifying a Select N condition, you can decide how many records or groups will be displayed in the table. You can also use an Integer-typed parameter to control the value of Select N.


Example of applying Select N conditions

The following example shows how to set the Select N conditions, both for the whole table and the groups in the table in detail.

  1. Create a table based on the query EmployeeInformation in the catalog file SampleReports.cat as follows: add the fields Name, Hire Date, Employee Position and Notes to be displayed in the table, set the field Assigned Region as the group by field and Descend as the sort order, and apply the default style to the table.

  2. Right-click the table and select Table Wizard from the shortcut menu.
  3. In the Group screen of the Table Wizard, select the Table node in the group by box, and then click the Select N button.
  4. In the Select N dialog, select Top from the Select N drop-down list and enter 2 in the combo box.
  5. Click OK to go back to the Table Wizard.
  6. Select the group by field Assigned Region in the group by box and click the Select N button again.
  7. In the Select N dialog, select Top, enter 2, check the Other box and enter Others in the text field.
  8. Click OK to close the Select N dialog, then click Finish in the Table Wizard to accept all settings.
  9. View the table again.

    You can find that the first 2 records in each group (the group Latin America has only one record) have been retrieved, and then the first 2 groups (North America, and Latin America) are displayed, with the records in the rest group combined into an additional Others group.