Skip to main content


Retrieves a saved select list.


GETLIST listname [TO listnum] [SETTING variable] [THEN statements] [ELSE statements]


listname A record ID assigned to a saved select list.
TO listnum Optional — A numbered select list, specified as an integer from 0 through 10. If omitted, select list 0 is used.
SETTING variable Optional — An integer count returned, which contains the number of elements in the specified select list.


The GETLIST statement retrieves a saved select list, making it available to the READNEXT statement. You specify the listname specifying the storage location of the select list, and the listnum of a numbered active select list into which to copy it. The select list was saved using WRITELIST.

The listname select list is saved in the &SAVEDLISTS& file. Caché stores this file using the ^SAVEDLISTS global.

You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the saved select list retrieval is successful, the THEN clause is executed. If saved select list retrieval fails (listname does not exist), the ELSE clause is executed. The statements argument can be the NULL 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 and cannot follow a THEN, ELSE, or END keyword on that line.

See Also

FeedbackOpens in a new tab