User's Reference - Sort

### Sort

Category

Transformation

Function

Sorts the values of a specified list or field in a specified order.

Syntax

    result = Sort(field, descending)

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`field` | scalar list or field | none | object to be sorted
`descending` | flag | 0 | 0: sort in descending order 1: sort in ascending order

Outputs

Name | Type | Description
--- | --- | ---
`result` | scalar list or field | sorted object

Functional Details

`field` | specifies the field or list to be sorted. If the parameter is a scalar list, its values must be scalars or 1-vectors. If the parameter is a field, the sorting is performed on the "data" component; other components are reordered and renumbered as appropriate.
`descending` | specifies the order of sorting: descending (0) or ascending (1).

Components

The "data" and data-dependent components are reordered according to their data values. Similarly, components on which data depends are reordered. Components that reference reordered components are renumbered.

Example Visual Program

    Sort.net

[ OpenDX Home at IBM | OpenDX.org ]