12. Report-Writer Statements : Report Setup Statements : .Sort Statement—Specify Sort Order of Reported Data : Examples
 
Share this page                  
Examples
1. Sort two columns of a table (whose names are specified by delimited identifiers), with both columns in ascending order:
.sort "last name","first name"
2. Sort three columns of a table, with first and last columns in descending order, and the second column in ascending order.
.sort dept:descending,
        jobcode,
        name:d
3. Sort the column specified by the value of the variable sort_col in the order specified by the value of the variable sort_order. For example, the value of sort_col might be last_name and the value of sort_order might be for ascending.
.sort $sort_col:$sort_order
...
.header $sort_col
...
.out \direct\subdirect\myreport.lis
.include \direct\subdirect\otherrep.rw