ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(B) (C/S) |
Warning: In the case of ADELIA programs, this instruction is not compatible with C generator, and cannot be used on an index.
Section for use
All
Syntax
READ_PR_ELT ListName
Description
When this instruction applies to a list, it reads the previous item in the list ListName and assigns the values to its component variables.
After running this instruction, the current item is the read item.
When this instruction applies to an index, it reads the previous item in index IndexName and assigns the values of the corresponding item in the list associated with the index to its component variables. The read item becomes the current index item and the current item in the list associated with the index. This use is not compatible with ADELIA type programs.
The predefined function &CODE_LST (on the list in the case of a list or on the index in the case of an index) indicates whether the read operation was successful.
Below are the possible values:
Value |
|
*NOT_FOUND |
The read did not find the item (empty list). |
*NORMAL |
The read was successful. |
*INVALID_OP |
The index does not exist (not yet created or has been destroyed). |
Example
* This section reads the last element in the graphical list INVOICES_LST,
* then reads the previous elements up to the first one.
READ_L_ELT INVOICES_LST
DO_WHILE &CODE_LST(INVOICES_LST) = *NORMAL
...
READ_PR_ELT INVOICES_LST
REDO
* Read index
LIST MyList Field1 Field2
LIST_INDEX MyIndex MyList Field1
*/ The list contains 4 items with the following values for Field1: 10, 2, 5 and 7
Field1 = 4
READ_F_ELT MyIndex
* Reads the list item with Field1 equal to 5
READ_PR_ELT MyIndex
*Reads the list item with Field1 equal to 2