LassoScript Utility
Basics Browse Detail


Tag Link [Array->Sort] Category Array
Type Member Source Available No
Support Preferred Version 5.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0


[Array->Sort] reorders the elements of the array in alphabetical or numerical order. Accepts a single boolean parameter. Sorts in ascending order by default or if the parameter is True and in descending order if the parameter is False.

Note: Only string, integer, or decimal values should be sorted. If an array contains arrays or maps then the results of sorting the array are undetermined. Pairs will be sorted by their first element (which should be either a string, integer, or decimal value).


[Array->(Sort: Sort Order)]


Optional Parameters
Sort Order If True, specifies the array should be sorted in ascending numeric or alphabetic order. If False, specifies the array should be sorted in descending order.


To sort the elements in an array:

Use the [Array->Sort] tag. The following example sorts the items in an array of the days of the week and outputs the sorted array.

  Variable: 'DaysOfWeek'=(Array: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
  Output: $DaysOfWeek->(Sort: True);
  Output: $DaysOfWeek;

(Array: (Fri), (Mon), (Thu), (Tue), (Sat), (Sun), (Wed))

Related Tags

Category Tags