Load from list

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

Syntax

Load from list {line-number (variable-names) {default is current line}}

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 transfers field values from the current list to the corresponding fields in the current record buffer. However, if you include a list of fields, the values in the current list are transferred to the specified fields (see example). Each column value, taken in the order it was defined, is copied to the corresponding field in the field list.

Field names parameter list

The command Load from list with '(CVAR1,,CVAR12)' specified will load the first column of the current line of the list into CVAR1, ignore the second column, and load the third column into LVAR12. If too few field names are specified, the other columns are not loaded. If too many field names are specified, the extra fields are cleared. Any conversions required between data types are carried out.

If the line number specified in the command line is empty, or if it evaluates to zero, the values are loaded from the current line. If the list is empty or if the line evaluates to a value greater than the total number of lines in the list, the flag is cleared and the fields in the parameter list or in the list definition are cleared.

Example

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)}
Do lMyList.$line.$assign(4) ## set the current line
Load from list ## load the values from the current line into lName and lAge
Load from list {2} ## load the values from line 2 into lName and lAge
Load from list {4 (lTmpName,lTmpAge)}

# load the values from line 2 into lTmpName and lTmpAge