Working with the Sort Expert
The Sort Expert is launched from a button on the Experts toolbar, and also via the Record Sort Expert item on the Report menu. Figure 3.5 shows the Sort Expert.
Figure 3.5 The Sort Expert dialog accessed from the Report menu.
To apply sorting to the report, select a field from the list of available fields on the left side of the dialog area, and click the arrow (>) button to add that field to the Sort Fields list. Note that like filters, sorts can use fields both on the report and fields not otherwise used in the report.
TIP
In addition to sorting on report and database fields, you can sort on formula fields. Creating a formula field enables you to sort a report based on a custom expression.
To see this in action, follow these steps:
Create a new report using the Employee table of the Xtreme Sample Database and add the First Name, Last Name, and Salary fields to the report.
Initially, this report doesn't tell you a lot because the data is in seemingly random order. However, if the report were sorted by last name, it would be more useful. To accomplish this, first launch the Sort Expert.
Select the Last Name field from the available fields list and click the arrow (>) button to apply a sort on it. Click OK to return to the report. Notice how the report's records are now sorted in alphabetical order by last name.
The Sort Expert enables you to sort on both alphabetic and numeric fields. To modify this report to sort on salary instead of last name, follow these steps:
Return to the Sort Expert and remove the current sort by selecting the Last Name field from the sort fields list and clicking the < button.
Now select the Salary field and add it to the sort fields list.
Alphabetic fields are usually sorted in ascending order (from A to Z), but numeric fields are often sorted both ways. In this case, select the Salary field in the Sort Fields list and click Descending for the sort direction. This lists the employees with the top salary first. Click OK to apply the sort and return to the report.
Notice that some employees have the same salary level. If you wanted to perform a secondary sort within duplicates of the primary sort field, you can simply add another sort field. These sort fields can be arranged up and down using the buttons near the top-right corner of the Sort Expert.