Caché MultiValue Basic Reference
SSELECT, SSELECTN, SSELECTV
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

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. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the ON ERROR keyword and the first line.
See Also