ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(I) (C/S) |
Warning: In the case of ADELIA programs, this instruction is not compatible with C generator.
Section for use
All
Syntax
INSERT_ELT ListName Position Change
Position |
→ |
*BEGIN | *END | *BEFORE | *AFTER |
|
|
| SortOption |
|
|
| None |
|
|
|
Change |
→ |
*CHANGE | None |
Description
This instruction inserts a new element in the list ListName, using the values of its variables.
The insertion position Position indicates the point at which the new element is to be inserted. A summary is given in the table below:
*BEGIN |
At the beginning of the list |
*END |
At the end of the list |
*BEFORE |
Immediately before the current position |
*AFTER |
Immediately after the current position |
*SORT(Fields) |
Insertion in ascending or descending sorting order, according to the fields specified |
The position parameter is optional; the default setting is *END.
With sorted insertions, you must define the fields to be used for sorting. By default, all the fields are included. You can specify the *ASC (ascending) or *DESC (descending) instruction for the fields set to be sorted. Where the order is not specified, the default setting is "ascending".
Click here for the explanation of the SortOption element.
The parameter Change sets the status of the inserted element to "Changed".
Warning: *MODIF cannot be used with ADELIA programs.
Once this instruction has been run, the inserted element becomes the current element. If the operation has completed normally, &CODE_LST returns *NORMAL.
The table below shows the various possible results:
List status |
Result |
List empty |
OK |
After a deletion |
*BEFORE = *AFTER, *END and *BEGIN and *SORT: OK |
After the end of the list |
*BEFORE = *AFTER = *END, *BEGIN and *SORT: OK |
Before the beginning of the list |
*BEFORE = *AFTER = *BEGIN, *END and *SORT: OK |
Current element defined |
OK |
Example
INSERT_ELT List
INSERT_ELT InvoiceList *BEGIN
INSERT_ELT CustomertList *BEGIN *CHANGE
INSERT_ELT ItemList *END
INSERT_ELT List *BEFORE
INSERT_ELT AgreementList *AFTER
INSERT_ELT CustomerList *SORT(CUST_ID *ASC)
* This section permits to insert item codes into a list ITEM_LST
LOADING_LST ITEM_LOADING
ITEM_LST:CURRENT_VALUE = IITEM_COD
INSERT_ELT ITEM_LST:LIST
END_LOADING_LST