Release 10.1A: OpenEdge Reporting:
Query/Results for Windows

> ## Sorting records

> By default, Results uses the primary index from the first table you included in the query to determine the order in which it retrieves and displays records.

> Figure 5–2 displays the items ordered by each customer. Note that Results automatically uses the primary index, Cust-Num, within the Customer table to sort the records in ascending order by customer number.

> Figure 5–2: Query displaying ordered items by customer

> You can alter the order in which the query retrieves records by choosing one or more fields as the criteria for sorting the records.

> For example, you might prefer to see the list sorted by order number, starting with the most recent order. In this case, you use the Order-Num field to sort the records in descending order, as shown in Figure 5–3.

> Figure 5–3: Query displaying ordered items by order number and date

> Then you might decide that you want to retrieve the orders for each customer, starting with the most recent order. In the Sports database, the order number increases with each new order. Therefore, you use two fields to sort the records: Cust-Num and Order-Num. Cust-Num is sorted in ascending order and Order-Num is sorted in descending order, as shown in Figure 5–4.

> Figure 5–4: Changing sort order example

> You can sort on all database fields and on the following types of calculated fields: Math, String Function, Numeric Function, Date Function, and Logical Function. See Chapter 6, "Analyzing Data," for more information on the different types of calculated functions.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095