An “ASC/DESC Order” element can be used in a Sort Expressions folder with any of the Ordered Analytical functions to specify a sort direction, either ascending or descending. The appropriate SQL keyword, either ASC or DESC, is automatically added to the SQL generated for the expression placed under the “ASC/DESC Order” node in the tree. If an “ASC/DESC Order” is not used, the default sort direction is given, depending on the Ordered Analytical function in use.
An example of an “ASC/DESC Order” in a Sort Expressions folder is given below
In order to set the sort direction, the user must either highlight the ASC/DESC Order node and click Properties, or double-click on the ASC/DESC Order node to display the following Properties dialog.
The Properties dialog presents two properties to set: Sort Order and Null Values in Sort Order. Sort Order defines the order in which values will be sorted, ascending from least to greatest or descending from greatest to least. Null Values in Sort Order defines where to put null values found during the sorting process. A selection of Nulls first puts null values before all other sorted values, while a selection of Nulls last puts null values after all other sorted values.
Clicking on OK causes the selected Sort Order and Null Values in Sort Order values to be used.