Skip to main content
Version: 5.3

sort

Description

Sorts data based on given parameters.

Syntax

sort [<global-sort-option>]  [<field-sort-option>]<field> [ , [<field-sort-option>]<field>]

Required Arguments

ParameterSyntaxDescription
field<field> [, <field>]The name of the field(s) to sort by.

Optional Arguments

ParameterSyntaxDefaultDescription
global-sort-option(+|-)+Sort type: + for ascending, - for descending.
field-sort-option(+|-)global-sort-optionSort type for specific fields: + for ascending, - for descending.
maxnum<integer>sme.core.sort_limitMaximum number of records processed during sorting.

Examples

Example 1

In this example, sorting is performed in descending order by the user field.

...
| sort - user

Example 2

In this example, sort works by default and sorts the user field in ascending order.

...
| sort user

Example 3

In this example, the general order - applies to the entire query, while for the id field it is overridden by the local +. The internalId field is sorted according to the general rule.

...
| sort - user, +id, internalId