GML::SORT - Sort Grid Data

Syntax

CALL "GML::SORT"

Description

This procedure sorts main grid data based on the data contained in a specific column. The GML_TPL$ template variable GML_TPL.ROW_C% is used to designate which column to use for the sort key. After sorting the data, the grid is redrawn; the column number relating to the most recent execution of the SORT procedure is retained in GML.S_STAT%[GML.SET%]. A positive value indicates the sort was arranged in ascending order, while a negative value indicates descending order. When the RESET procedure is executed, the value in GML$ variable GML.S_STAT%[GML.SET%] is set to 0.

Options

(The values in the GML_TPL.OPTION% variable are additive)

If GML_TPL.OPTION% is set to 1, the GML_TPL.REL$[sort column] values will be used as the key for the sort.

If GML_TPL.OPTION% is set to 2, the sort will be arranged in descending order (reverse sort).

Setting GML_TPL.OPTION% to 3 will use the GML_TPL.REL$[sort column], with the sort in descending order.

GML_TPL.OPTION% set to 4 will update the column header after the SORT procedure is executed. This option is useful when the GML_TPL$ template that was used to execute the SORT procedure also contains changes in the GML_TPL$ variables effecting images added or removed from the column header.

GML_TPL.ARG% is used to specify the use of the CVS (string conversion) function when building the sort keys. The values for GML_TPL.ARG% are the same as used with the CVS function.

If a mask is provided in the GML_TPL.MASK$[sort column] variable, and the mask contains zero(s) and a decimal point (optional), the column will be sorted as numeric using that mask.

Additional Notes

If there is a problem when executing the SORT procedure, the GML.FLAG% variable will contain a –18. In addition, the GML_TPL.FLAG% variable will contain the VPRO/5 error number, and the GML_TPL.ROW_N% will contain the row number causing the error.

If the SORT procedure is executed while a cell is in the edit mode, a GML.FLAG% value of –19 will be returned (the sort procedure will not execute).

Example

2400 GML.SET%=1
2410 CALL "GML::TPL_PREP"
2420 GML_TPL.COL_N%=3
2430 CALL "GML::SORT"

See Also

Visual PRO/5 Grid Management Library

Alphabetical Listing of GML Procedures