The preceding report lists items in an order based on where they are located in the file. Assume, however, that the user wants to display customer names in alphabetical order. To specify the order of items in a report, use a sort expression, which specifies the attribute by which to sort and whether to sort in ascending or descending order. A SORT statement consists of a command with sorting capabilities, (such as the SORT command), one of the four BY modifiers, and the name of the attribute whose data will be sorted.
This list includes sample sort expressions:
SORT CUSTOMERS BY LAST-NAME |
SORT ORDERS BY-DSND AMOUNT |
SORT ORDERS WITH AMOUNT > "250" BY AMOUNT |
SORT CUSTOMERS BY STATE BY LAST-NAME |
The following query example sorts customers by their last names:
>SORT CUSTOMERS WITH STATE = "IN" BY LAST-NAME LAST-NAME STREET CITY STATE ID-SUPP |
|||
|
|
|
|
PAGE 1 |
|
10:44:56 DD MMM YYYY |
|
|
|
|
|
Last Name. |
Street............. |
City........ |
State |
|
|
|
|
ASH |
912A E. OAK STREET |
INDIANAPOLIS |
IN |
BUCKLER |
26 STONE AVENUE |
LINCOLN |
IN |
JENKINS |
1222 MAIN STREET |
INDIANAPOLIS |
IN |
MASON |
226 ROCK ROAD |
LINCOLN |
IN |
|
|
|
|
4 ITEMS LISTED. |
|
|
|
|
|
|
|
> |
|
|
|
See Also
Sending a Report to the Printer