ORDERBY function

Synopsis
This function sorts an array after applying an expression to each element .
Variations
ORDERBY(SourceArray, Expression)
Returns all elements in the source array, sorted in ascending order, after performing an expression on each element.
Parameters
SourceArray

Specifies the array to sort.

Supported types: Numeric array; String array; Boolean array; Point array; Object array.
Expression

Specifies the expression to apply to each element of the source array.

Supported types: Numeric; Boolean; String.
Returns
Returned types: Numeric array; String array; Boolean array; Point array; Object array.
Examples
1.

The following example sorts the source array in ascending order after applying the expression to each element, and the function returns the array [1, 2, 3, 4, 5].

ORDERBY([3, 1, 4, 5, 2], Item)
2.

The following example returns an array of blobs ordered from smallest to largest area.

ORDERBY(BlobAnalysis.BlobFound, Item.Area)