Insert line in list

Command group Flag affected Reversible Execute on client Platform(s)
List lines YES NO NO All


Insert line in list {line-number (values) {default is current line}}


This command takes the current field values and inserts them at a particular line in the list. The new line is inserted before the specified line and all the lines below the specified line are moved down one place.

If a set of comma-separated values is included as a parameter, these values are read (in order) into the columns of the new line. In this case, the field names for the columns are not used to specify the data for the new line.

You can specify the line number using a calculation. However, if the parameter for the command is empty or evaluates to zero, the current line is used, that is, the field values are inserted at the current line and all other lines are moved down one place.

If there is no current line (LIST.$line = 0), the field values are added at the end of the list. If the line is beyond the current end of the list (for example, the LIST.$line given is greater than LIST.$linecount),Insert line in list is equivalent to Add line to list. The flag is cleared if the list is already at its maximum size (LIST.$linemax).


; Insert 10 lines in between the 2 exisiting lines
Set current list lMyList
Define list {lName,lAge}
Insert line in list {('Fred',10)}
Insert line in list {('George',20)}
For lCount from 1 to 10 step 1
  Insert line in list {2 ('Harry',22)}
End For
; Alternatively, you can use the $addbefore() and $addafter() methods to add lines to a list
Do lMyList.$addbefore(1,'Harry',22)
Do lMyList.$addafter(2,'William',31)