Delete line in list

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

Syntax

Delete line in list {line-number (calculation)}

Deprecated Command

This command has been deprecated and is no longer visible in the Code Assistant in the Code Editor (it will not appear when you type the first few characters), although it is still present in Omnis Studio and will continue to function if used in legacy code. You can show this command by disabling the appropriate Command Filter in the Modify menu in the Code Editor.

Description

This command deletes the specified line of the current list by moving all the lines below the specified line up one line. If the line number is not specified or if it evaluates to 0, the current line LIST.$line is deleted. The line in a list selected by the user can determine the value of LIST.$line and is the line deleted if no parameters are specified. LIST.$line is unchanged by the command unless it was the final line and that line is deleted; in this case LIST.$line is set to the new final line number. The command never releases any of the memory used by the list.

The flag is cleared if the list is empty or if the line is beyond the current end of the list; otherwise, the flag is set.

Example

# Delete all but the first 2 lines in the list
Set current list lMyList
Define list {lName,lAge}
Add line to list {('Fred',10)}
Add line to list {('George',20)}
Add line to list {('Harry',22)}
Add line to list {('William',31)}
Add line to list {('David',62)}
While lMyList.$linecount>2
  Delete line in list {1}
End While
# Alternatively you can use $remove to delete a line from a list
Do lMyList.$remove(1)