Was this helpful?
Sort Order
Sort order determines the order in which data is presented in a report. There are two components to sort order:
Sort sequence
Sort direction
Sort sequence is the order in which the columns are sorted. You designate one column as the primary sort column. For instance, in a report of employees, you could designate the Lastname column as the primary sort column so that the report can be sorted according to last name.
You can designate additional columns as subordinate sort columns. Subordinate sort columns sort data within each sort value of the primary sort column. For example, if the primary sort column is Zipcode and the secondary sort column is Lastname, all of the data rows containing zip code 00001 are presented first. Within the 00001 group, the data rows are sorted by the alphabetic order of the names in the Lastname column.
If you do not specify a sort order, data appears in the report in whatever order it was stored in the table, view, or JoinDef on which the report is based.
Sort Direction
Sort direction is another component of sort order. The sort direction is ascending or descending. In ascending order, the lowest values are presented first (1,2,3, a,b,c). In descending order, the highest values are given first (9,8,7, z,y,x).
Sort Order and Data Type
Sort order is performed according to the data type of the column:
Date columns are sorted in ascending or descending chronology.
Numeric columns are sorted by ascending or descending numeric value.
Character columns are sorted in ascending or descending alphabetical order.
This means that numbers entered in a character column (in an address, for instance) are sorted differently than numbers entered into a numeric column. Numbers in a character column are sorted alphabetically, as shown in the following sample table:
Numbers sorted in numeric column
Numbers sorted in character column
1
1
2
101
3
11
11
12
12
2
22
22
101
3
Default Sort Order
When you create a default report specification or preview report, RBF sets an initial default sort order based on the values in the first column of the table, view, or JoinDef on which the report is based. Two exceptions to this are Indented reports and Master/Detail joins, which can have multiple sort columns.
The following rules apply:
If the data type of the sort column is character, RBF sorts report rows in ascending alphabetic order on the first column.
If the data type of the sort column is numeric, RBF sorts report rows in ascending numeric order.
If the data type of the sort column is date, then RBF sorts report rows according to ascending chronological order.
Except for Indented reports, if the first column contains duplicate values, RBF sorts the rows in an indeterminable manner.
For Tabular reports with duplicate values in the first column, RBF prints the duplicate value only once and does not print a value in the first column until the value changes.
Sort Columns and Breaks
Before you create a break header or footer, you must designate the column you want to break on as a sort column. If you change the sort order of the columns, the order of the report's break headers and footers also changes.
How to Change a Column from Sort to NonSort
If the column has an associated break header or footer, RBF does not allow you to change a sort column into a non‑sort column. In this case, you must delete the associated break header or footer first with the Layout operation (see page 21).
Additionally, if you try to change a sort column into a non‑sort column, you must decide what to do with any unique aggregates. You can:
Delete all unique aggregates associated with the column
Change the unique aggregates to non‑unique aggregates
Change the Sort Order
To change the sort order of your report
1. Select the ColumnOptions operation from the Report Layout frame menu.
The Column Options frame (in the seventh figure) appears, with a default sort order (see page 28) based on the first column of the table, view, or JoinDef on which your report is based.
2. Tab to the Sort Sequence field and enter the order in which you want the column sorted.
You can have from 1 to 1024 sort columns, with 1 as the primary sort column, 2 as the secondary, and so forth.
If you do not want to designate a column as a sort column, set the sort order to zero (0).
3. For each sort column designated, establish the sort direction:
d. Tab to the Sort Direction field.
e. If necessary, type a (for ascending) or d (for descending) over the values currently in the field and press Return. (RBF fills out the field with the complete word for you.)
4. Select the End operation to return to the Report Layout frame.
Last modified date: 08/28/2024