Define list

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

Syntax

Define list {list-of-field-or-file-names (F1,F2..F3,F4)}

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 defines the variables or file class field names to be used as the column definitions for the current list; it should follow Set current list. The variables or fields used in the definition also describe the data type and length for each column of data held. This command clears the definition and data in the current list. When reversed, the contents and definition of the current list are restored to their former values. Duplicate names are ignored in your list of variables or fields.

Example

Set current list iList1
# define columns iCol1Date, iCol2Num & iCol3Char for the current list
Define list {iCol1Date,iCol2Num,iCol3Char}
# same as before but ignores the duplicate reference to iCol3Char
Define list {iCol1Date,iCol2Num,iCol3Char,iCol3Char}
# define the list based upon all the columns in the file class fCustomers
Define list {fCustomers}
# Alternatively, you can avoid using Set Current List by using the following notation
Do iList1.$define(iCol1Date,iCol2Num,iCol3Char)
# define the list based upon a table,schema or query class
Do iList1.$definefromsqlclass('myTableOrSchemaOrQueryClass')
# FIXED LENGTH COLUMNS
# Normally, the length of a column is set by the type or length of the variable or field defined for
# the column, therefore the column length for a default character variable would be 10 million.
# However, when you define the list you can truncate the data stored in the column using
# VariableName/N. For example to use only the first 10 characters of the variable iCol3Char in column 3
Define list {iCol1Date,iCol2Num,iCol3Char/10}