Organizing data in a report : Sorting data

Sorting data

Sorting data is an important task in creating a useful report. A customer phone list, for example, is easier to use if it is in alphabetical order. A sales report is more useful if it presents sales figures from highest to lowest, or the reverse, if you want to see lowest to highest performers.

You use sorting to display report content in a more meaningful order. For example, reports often display data in a seemingly random order depending on the report design. You can sort data in ascending or descending order, and you can sort by as many fields as needed. For example, you can sort a list of customers by credit rank, then by customer name.

When the report columns are sorted, the uppercase entries are displayed first followed by the lowercase entries. For example, if the entries are ANT, aggr0 and DR_AGGR, on sorting the entries will be displayed in the order ANT, DR_AGGR and aggr0. This is because the sorting is done on the basis of UCS-2 (2-byte Universal Character Set).

Compare the reports in Figure 4-3. The report on the left displays data as in the original report. The report on the right displays the same data, sorted by country.

Figure 4-3  Comparing reports with sorted and unsorted data

You can sort data in ascending or descending order, and you can sort data by multiple columns. For example, you can sort the data in a report by country, and then by customer name. Figure 4-4 shows a sample of the results of this sort action. Countries appear in ascending alphabetical order. For each country, the customer names appear in alphabetical order.

Figure 4-4  Customer names sorted in alphabetical order