RAD function: setsort

A RAD function that sorts the fields in a table. The setsort function allows for a third parameter so that it could be an array of numbers, zero or one (0 or 1). The entries in this array correspond to the entries in the name array. A 0 indicates the field will be used to sort in ascending order and a 1 indicates the field will be used to sort in descending order. A 0 or 1 can also be used to sort on all fields in ascending or descending order.

Function

setsort

Format

p
 setsort($L.file, $L.arrayofnames, 0): ascending sort
 setsort($L.file, $L.arrayofnames, 1): descending sort
 $L.void=setsort($L.file, $L.arrayofnames, $L.arraysortorder)

Example

If you wanted to sort a list of contacts by name (ascending), age (ascending), and state (descending).

$L.arrayofnames={"name","age","state"}
$L.arraysortorder={0,0,1}
$L.void=setsort{$L.contacts, $L.arrayofnames, $L.arraysortorder}