Skip to main content
Version: v0.18.0

ArraySort

Alias:ArraySort, SortArray, Sort

Output:Array of T

Reorder an array or entity stream

ParameterTypeRequiredPositionDefault ValueSummary
Arrayarray<T>✔1The array or entity stream to sort
KeySelector
Using
T2Default OrderingA function that gets the key to sort by. Use this function to select an entity property that will be used for sorting. To sort by multiple properties, concatenate several keys
Descendingbool or SortOrder3FalseWhether to sort in descending order.

Examples​

Example 1​

SCL​

ArraySort [2, 4, 1, 3] Descending: true

Expected Output​

[4, 3, 2, 1]

Example 2​

SCL​

Sort [
('type': 'C', 'value': 1)
('type': 'A', 'value': 2)
('type': 'B', 'value': 3)
] Using: (<>['type'])

Expected Output​

[('type': "A" 'value': 2), ('type': "B" 'value': 3), ('type': "C" 'value': 1)]