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) element 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 panel.
- 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.
Clicking OK will cause the selected Sort Order and Null Values in Sort Order to be used.