Skip to main content

SSELECT, SSELECTN, SSELECTV

Selects and sorts items into a select list.

Synopsis

SSELECT dynarray [TO listnum] [ON ERROR statements]
SSELECT [filevar] [TO listnum] [ON ERROR statements]
SSELECT dynarray TO listname [ON ERROR statements]
SSELECT [filevar] TO listname [ON ERROR statements]

SSELECTN dynarray [TO listnum] [ON ERROR statements]
SSELECTN [filevar] [TO listnum] [ON ERROR statements]

SSELECTV dynarray TO listname [ON ERROR statements]
SSELECTV [filevar] TO listname [ON ERROR statements]

Description

The SSELECT statements sort the contents of a select list or file into string collation order and place the results in a select list. The SSELECT statements sort the contents of a file system directory into string collation order and place the results in a select list. The SSELECT statements copy the elements of a dynamic array into a select list in the order listed; they do not sort dynamic array elements. To sort dynamic array elements, use SELECT to copy the elements into a select list, then use SSELECT on that select list.

When sorting the contents of a select list, SSELECT removes duplicate values. Therefore, an output select list may contain fewer items than the input select list.

The output select list can be a numbered select list or a named select list. The “N” and “V” command name suffixes specify whether the output select list is a numbered select list or a named select list.

The SSELECT statements sort in ordinary string collation order. The SELECT statements sort in Caché storage order: first the empty string, then canonical numbers in ascending numeric order, then strings in string collation order. The SSELECT statements are otherwise comparable to the corresponding SELECT statements.

The optional ON ERROR clause specifies one or more MVBasic statements to execute if the SSELECT operation fails. For example, if you specify an invalid listnum the ON ERROR statements are executed.

See Also

FeedbackOpens in a new tab