ORDERBY
= optional in Column A
Parameter | Mandatory/Optional | Value (example) | Occurrence in column A | Comment | |
---|---|---|---|---|---|
FORMS | REPORT | ||||
ORDERBY | 1 | 1 | To override the default order-by that is added to each SQL query (same as the order of the group by "*" columns), then this parameter can be defined in column A and number each "*" column with a number. |
ORDERBY is an optional parameter that can be used to override the default order by that is added to the SQL queries when a document is generated. By default, the order will be the same as the order of the group by columns (columns with * as SOURCE). To create another order, ORDERBY must be defined in column A and for all columns with SOURCE=*, a number (1,2, 3 and so on) must be added to state the order.
Default the result will be sorted ascending in the order defined by the ORDERBY values. For example, the column with value 1 appears first, and then the column with value 2, and so on . However, if the ORDERBY value is defined with a "-" (negative sign) before the value (i.e. -1), then the result in that column will be sorted in descending order. One column can be ordered descending and another can be ordered ascending.
Note: If the GROUPBY parameter in PARAM is set to FALSE, in other words, no group by will be added to the SQL queries, then it is recommended to define ORDERBY for all columns with SOURCE=*. Otherwise, no specific order will be used when inserting the data in the document.
In the template worksheet the ORDERBY row should be defined with ROWTYPE = DESIGN (the row will be hidden when document is generated).
Enter the order by which the columns should be sorted. In the example below, the queries should be ordered by ITEMGRP, ITEM: