DsSort
The DsSort element is used with DataLayer.Data Services to add a sorting operation to Dataview processing. This topic discusses
the use
of this element.
For more information about Dataviews, see Dataviews.
Using the DsSort Element
The DsSort element discussed here is available in Logi Info v12.5 but has been deprecated in later Info versions; consult the Release Notes for specific details.
The following examples illustrate how the DsSort element can be used:
The table above shows the data as it appears without any sorting. Note the order of the CustomerID column data. Now let's sort that column:
- As shown above, add DsSort element beneath a DataLayer.Data Services element.
- Set its Sort Column attribute value to the name of the column in the data, CustomerID, to sort on.
- The optional Sort Sequence attribute value, which defaults to Ascending, can be set to Descending if desired.
When the report is run again, the data will now be sorted in Ascending order on the CustomerID column, as shown above.
- If a second column is added to the first in the Sort Column attribute value, separated by a comma as shown above, the sort will occur on multiple columns.
The data will now be sorted first on one column and then on the second, as shown above (we've removed some intervening columns in the image to make the sorted columns easier to compare). You can also set different sort orders for different columns by entering the Ascending and Descending options in the Sort Column attribute, separated by commas (this assumes the columns are the same data type). In situations where the columns to be sorted are not the same data type and/or need to be sorted in opposite directions (one in Ascending order and one in Descending order) additional DsSort elements can be used, one for each column.
The order of the DsSort elements in the element tree will be significant in this case.
Dynamic Sorting
The DsSort element has an Include Condition attribute:
If the value of this attribute is left blank or contains a formula that evaluates to True, the element is applied to the data. If the value evaluates to False, the element is ignored and does not affect the data. This allows you to dynamically determine if the data will be sorted or not.