To create groups for a report, the information in the report must be sorted in a way that allows the groups to be formed. This means the information for the report must be sorted first by the primary field that identifies each group, then by the items in the group. For example, if you are creating a report that groups customers by state or province, the report must first be sorted by the State field, and then by the Customer Name.
For optimal performance when printing the report, you should use an existing key from the primary table to specify how the data for the report is sorted. However, when you are creating groups for a report, there often isn’t a key available for the primary table that sorts the data appropriately. This is especially true when you want to create groups based on data in secondary tables for the report. In this case, you must create a sort order to indicate how to sort the data for the report. This is described in Sorting.