DataBasic Reference > Statements and Intrinsic Functions > G > GETLIST Statement

Comment on this topic

Documentation Comments

Use this form to comment on this topic. You can also provide any general observations about the Online Documentation, or request that additional information be added in a future release.

Reality V15.0 ()

GETLIST Statement (DataBasic) (m618703+getlist_s.htm)

To

Reality

Version

Topic

Submitted by

Company

Location

Email address

Comment

 

 

GETLIST Statement

Produces a list of item-ids for a subsequent PERFORM or READNEXT statement.

Syntax

GETLIST list-name {account-name} {TO listVar} {SETTING setting-var} [THEN statement(s) | ELSE statement(s)]

Syntax Elements

list-name is any expression that evaluates to the name under which the list was saved.

account-name specifies an account, other than the current account.

listVar is a variable to which the list is assigned.

If the TO clause is omitted, the default select-variable is used.

setting-var is the name of a variable to which the number of items in the list is assigned if the SETTING clause is used.

statement(s) is either a THEN or ELSE clause (or both). A statement must be included. The THEN clause is executed if GETLIST is successful. The ELSE clause is executed otherwise.

Operation

If the list does not exist in POINTER-FILE, the ELSE clause is executed.

The list might have been previously saved in POINTER-FILE by a SAVE-LIST, COPY-LIST or EDIT-LIST command executed at TCL or from a WRITELIST statement executed in a DataBasic program.

Multiple pointers into the same list can be maintained by executing multiple GETLIST statements to the same list-name and assigning the results to different variables.

Any number of GETLIST statements can be executed in a DataBasic program, and any number of lists can exist simultaneously by specifying the TO clause.

Examples

GETLIST "TEXT" ELSE STOP

Produces a list of item-ids using the default select-variable.

X = "SAVE.DATA"
GETLIST X TO Y SETTING NUMBER ELSE PRINT "NOT FOUND"; STOP
READNEXT ID FROM Y ELSE...

Selects item-ids in list SAVE.DATA and assigns it to variable Y. The number of items in the list is assigned to variable NUMBER. If list does not exist in the POINTER-FILE, the error message prints and the program terminates.

GETLIST "S.CARS SYSPROG" TO LIST ELSE STOP
READNEXT ID FROM LIST...

Selects list of item-ids previously saved in list S.CARS in the SYSPROG account and assigns it to variable LIST.

RealityV15.0Comment on this topic