Sort criteria

A sort criteria defines the AQL collation sequence. The sort is invoked by the by, by-dsnd, by-exp, or by-exp-dsnd modifiers in a left-to-right order to determine the order in which items are processed by AQL. There is no limit to the number of sort keys within an AQL sentence.

Example(s)

This example has one sort key. It produces a listing of the entity item-ID and name attribute sorted by the value of the first name in each entity item.

list entity by name name

This example has three sort keys. First, the data in entity is sorted by ascending state sequence, then within state by ascending city sequence, and within city by ascending name. The attributes listed in the file's macro or output-macro display.

list entity by state by city by name

This example reverses the normal sort order and sorts the highest values to the top of the list. This is useful for circumstances such as determining who owes you the most money.

list invoices by-dsnd amount.due