# GETLIST

Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

# Description

GETLIST allows the program to retrieve a previously stored list (perhaps created with the SAVE-LIST command), into a variable. It takes the general form:

GETLIST expression TO variable1 {SETTING variable2} THEN|ELSE statements
1

Where:

  • variable1 is the variable into which the list will be read.
  • expression should evaluate to the name of a previously stored list to retrieve, or null. If expression evaluates to null, the current default external select list (generated by a previous SELECT command for example) will be retrieved.
  • If specified, variable2 will be set to the number of elements in the list.
  • If the statement succeeds in retrieving the list, then the statements associated with any THEN clause will be executed. If the statement fails to find the list, then the statements associated with any ELSE clause will be executed.

The GETLIST statement is identical in function to the READLIST statement.

An example of use is as:

GETLIST "MyList" TO MyList ELSE STOP
* Loop until there are no more elements
LOOP WHILE READNEXT Key FROM MyList DO
......
REPEAT
1
2
3
4
5

See also: DELETELIST, WRITELIST

Go back to jBASE BASIC

Go back to Programmers' Reference Guide