Guide to Applications

How to Sort Data Elements

You can sort data elements in the ascending or descending order. For this, you need to specify the field to order the elements by and, optionally, the order (direction). The ascending order is assumed when none is specified.

Please note that only data elements (elements of the DataElements type) can be sorted. Simple elements and data folder elements cannot be sorted.

To sort data elements:

  1. Locate a DataElements element you want to sort in a specific order.
  2. Add an OrderBy element within the element.
  3. Add the Field element within the OrderBy element.
  4. Specify its required attribute:
  • FieldName: The name of the field used to order data elements by

If necessary, specify its optional attribute:

  • Direction: The order to sort data elements by
  <OrderBy>
    <Field FieldName="Date" Direction="descending"></Field>
  </OrderBy>

Listing 18: Sorting by Date in Descending order

Please note that the DataElements element can only contain one OrderBy element. The OrderBy element can contain as many Fields elements as you need.