Tutorial - Lesson 7

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

 

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 Zip Code) 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:

 

RBSort

Adding Sort Band to report

 

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:

 

RBSort2

Locating the sort field in dictionary

 

We want this report to be sorted on the Zip Code field of the respondents database, so we expand the "tree" for "Respondents" to display all the field names for the database. Scroll down and double click (with the left mouse button) on the Zip field to enter the field name into the entry field for the Sort Expression box:

 

RBSort3

Adding sort field

 

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:

 

RBSort4

Sort band displaying sort field

 

This lets 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:

 

RBReport3

Sample report with Zip Code sort band

 

Notice that the Zip Code field entries are now sorted sequentially.

 

To recap; in this lesson you learned:

 

You control how database information is sorted on a report

 

The report engine uses the Sorting Band to perform sorting on a database

 

How to create a Sorting Band on a report

 

How to select a database field from the dictionary to sort on