READLIST Statement

Creates a dynamic array from a select-list.

This version of the READLIST statement is provided for compatibility with mvEnterprise. It is only available in MVENTERPRISE mode (set with the $OPTIONS statement).

Syntax

READLIST dyn-array {FROM [fileSelectVar || listVar || listNumber]} [THEN statement(s) | ELSE statement(s)]

Syntax Elements

dyn-array The name of a variable to which the dynamic array will be assigned.

fileSelectVar The name of a variable containing a file select list assigned using the SELECT statement.

listVar The name of a variable containing a select list created using the SELECT or FORMLIST statement, or loaded using the GETLIST statement.

listNumber Must be 0. Specifies the active select list.

If the FROM clause is omitted, the internal default select variable is used if it is available.

statement(s) is one or more DataBasic statements. You must include either a THEN or an ELSE clause (or both). The THEN clause is executed if the dynamic array created has one or more elements. The ELSE clause is executed if the specified select-list is empty or inactive.

Comments

Once the dynamic array has been created, the select list will be empty and no longer active.

If part of the list has been used previously, READLIST will create the dynamic array from the remainder.

Example

$OPTIONS MVENTERPRISE
OPEN "NAMES" TO FIL THEN
     SELECT FIL TO LST
     READLIST ARY FROM LST THEN
        ARY = CHANGE(ARY, @AM, ",")
     END
END

This example opens the file NAMES in the current account and selects the items it contains. It then reads the item-id's into a dynamic array and converts that array into a comma-separated list.