Set final line number

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

Syntax

Set final line number {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 explicitly sets the value of LIST.$linecount by specifying a line number or a calculation. Omnis expands or contracts any list as necessary and maintains the value of the LIST.$linecount property as the last line number. If the number of lines in the list is less than the number set for LIST.$linecount, Omnis adds empty lines to the end. If the number of lines is greater than LIST.$linecount, Omnis shortens the list and reduces the memory needed by the list.

You can use Set final line number to speed up list handling by setting the final line number to shorten lists, for example. The list is effectively cleared of data when the line number parameter is left blank (or evaluates to zero).

Example

# Reduce the number of lines in the list from 100 to 50
Set current list lMyList
Define list {lCol1}
For lCol1 from 1 to 100 step 1
  Add line to list {lCol1}
End For
OK message {List has [lMyList.$linecount] lines}
Set final line number {50}
OK message {List now has [lMyList.$linecount] lines}