Tutorial - Page 7
Sorting information on a report is crucial for locating information - can you imagine using your phone book if the names of everyone inside weren't sorted by last name? The Report Builder allows you to sort information how YOU want it to be sorted. Reopen the report so it is displayed in the Report Formatter screen once again.
The Report Builder engine uses a Sorting Band to sort data the way that you want it to. To add a Sort Band to your report to enable sorting on a database field (in this example, the last name) select BAND, then NEW, then SORTING BAND. You'll notice that the cursor changed to a pointed hand. Move the hand until the tip of the finger is on top of the word DETAIL in the detail band, then left click the mouse. Your report will now look like this:
Notice that above the DETAIL band is a new entry named "Sorting Band 1", and a dialogue box titled "Sort Expression" is displayed below it; the Report Builder is asking you how to sort the database information. You will be using the dictionary to select the database field as the primary sort - click the button with the flashlight to display the dictionary onscreen:
We wanted this report to be sorted on the Last Name field of the database, so we expand the "tree" for "Names Database" to display all the field names for the database. Double left click on the Last Name field to enter the field name into the entry field for the Sort Expression box:
Notice that the field name is now entered into the entry field; click the SAVE button. The information displayed in the Sorting Band detail is now changed to this:
This let's you know how this Sorting Band will be sorting information. Go ahead and test the sort by saving the report, then exit the Report Formatter screen and print a sample report. Here is what the report looks like now:
Notice that the Last Name field entries are now sorted alphabetically.