When you insert data in a BIRT design, data rows appear in the sort order specified in the data set, if a sort order is specified. If no sort order is defined, data rows appear in the order in which they were added to the database. Using Report Studio, you can arrange the data rows in a meaningful order by sorting the data. Compare the reports in Figure 8‑1.
Figure 8‑1 Displaying unsorted and sorted data in BIRT designs
The report on the left displays the data rows as they exist in the data set. You can sort data in ascending or descending order, and you can sort data by multiple columns. The report on the right displays the same data sorted by country in alphabetical order.
How to sort data on a single column
To sort data on a single column, select and right‑click the column. Then, choose Sort➛Sort Ascending or Sort➛Sort Descending.
You can sort data by as many as three columns using Advanced Sort, as shown in Figure 8‑2.
Figure 8‑2 Specifying advanced sorting
When sorting data on multiple columns, consider the order of precedence for the sort action. In Advanced Sort, select the columns in the order in which to sort data. For example, to sort data by city first, then by customer name, you must select the columns in that order on Advanced Sort.
How to sort data on multiple columns
1 Select and right‑click a column. Choose Sort➛Advanced Sort.
2 In Advanced Sort, select a column from the first drop‑down list, and choose either Ascending or Descending order.
3 Select another column from the second drop‑down list, and choose the sort order.
4 Optionally, select a third column on which to sort.
How to restore data to its original order
To restore data to its original, unsorted order, complete the following steps.
1 Select and right‑click a column. Choose Sort➛Advanced Sort.
2 In Advanced Sort, for each column in Sort by containing a defined sort order, select Select a Column from the drop‑down list. Choose OK.