Develop > Programming > System Language reference > List: rtecalls > rtecall("sort") function

rtecall("sort") function

A RAD function that sorts a list or a list of lists in ascending or descending order.

Function

rtecall("sort")

Format

$L.success.flg=rtecall($L.fnc.name, $L.return.code, $L.grid, $L.index, $L.type, $L.nulls)

Parameters

The following parameters are valid for the rtecall("sort") function:

Parameter Data type Description
$L.success.flg Logical Indicates whether or not the function was successful.
$L.fnc.name String Name of the sub-function to call, in this case "sort".
$L.return.code Number Provides a more detailed return code.
$L.grid Array The list or list of lists to be sorted.
$L.index Number The index of the array in the grid to use as the sort field. A zero (0) is the first element of the array.
$L.type Number The type of sort to perform. Use zero (0) for an ascending sort or one (1) for a descending sort.
$L.nulls Number Specifies how the function should sort null values. Use one (1) to sort null values at the end of the list or zero (0) to sort values at the start of the list.

Factors

If the $L.success.flg is false, the function failed. If it is true, the function succeeded.

Examples

$L.list={29, 2, 72, 42}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 0)
Returns: $L.list={2, 29, 42, 72}
$L.list={29, 2, 72, 42}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 1)
Returns: $L.list={72, 42, 29, 2}
$L.list={29, 2, , 72, 42}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 0, 1)
Returns: $L.list={2, 29, 42, 72, }
$L.list={29, 2, , 72, 42}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 0, 0)
Returns: $L.list={, 2, 29, 42, 72}
$L.list={{"a", "b", "d", "c"},{1, 3, 4, 2}}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 0)
Returns: $L.list= {{"a", "c", "b", "d"}, {1, 2, 3, 4}}
$L.list={{"a", "b", "d", "c"},{1, 3, 4, 2}}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 1, 1)
Returns: $L.list={{"d", "b", "c", "a"}, {4, 3, 2, 1}}
$L.list={{"a", "b", "d", "c"},{1, 3, 4, 2}}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 0, 0)
Returns: $L.list={{"a", "b", "c", "d"}, {1, 3, 2, 4}}
$L.list={{"a", "b", "d", "c"},{1, 3, 4, 2}}
$L.success.flg=rtecall("sort", $L.return.code, $L.list, 0, 1)
Returns: $L.list={{"d", "c", "b", "a"}, {4, 2, 3, 1}}