Skip to main content

sort (Function)

Function returns lists sorted in ascending or descending order.

Syntax

<OBJECT> list:sort(<OBJECT> list)
<OBJECT> list:sort(<OBJECT> list, <STRING> order)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
listThe list which should be sorted.OBJECTNoYes
orderOrder in which the list needs to be sorted (ASC/DESC/REV).REVSTRINGYesNo

Example 1

list:sort(stockSymbols)

Function returns the sorted list in ascending order.

Example 2

list:sort(stockSymbols, 'DESC')

Function returns the sorted list in descending order.