RAD routine: as.sort

A RAD routine used to sort a structure that includes an array. It sorts based on the contents of a particular field within the array of the structure. This routine supports major, minor, and intermediate sorting by allowing you to sort multiple array fields in the structure with one pass of the routine. You can also specify an ascending or descending sort order. You must call this routine from Format Control or RAD on an as-needed basis.

Routine

as.sort

Parameters

The following parameters are valid for the as.sort routine:

Name Data type Required Description
file record No The file variable currently being edited. The value is always $file when called from Format Control.
name character No

The name of the structure you want to sort. This name corresponds to the input field of the subform object in the form to which the Format Control record is attached.

Note If the data passed to this parameter does not contain commas, it is considered an arrayed structure name. If a comma is found, the as.get.name application executes against the data.

numbers

array

(numbers)

Yes

Specifies the field numbers on which to sort within the arrayed structure. In Format Control, you must first define a $variable in the Initializations form for the array of numbers. Next, pass that variable to the numbers input field in the Additional Options definition.

Note Field numbers correspond to the index numbers listed in the database dictionary and not to the sequence in which they appear on the form.

condition

array

(Boolean)

No

Specifies either ascending or descending order for each field being sorted in the arrayed structure, as specified in the numbers parameter. To specify an ascending order, pass a value of true. To specify descending order, pass a value of false. The default value is true.

Each element in this array has a direct correlation with the elements of the numbers parameter. In Format Control, you must first define a $variable in the Initializations screen that defines the Boolean array. Next, pass the variable to this input field in the Additional Options definition.