Lists

A list variable contains multiple values of fields and variables. Omnis lets you define and build as many lists of data as memory allows. A list defined from a schema, query, or table class has the properties and methods of a table instance.

A list variable with the smart list property enabled contains two lists: the normal list, containing the list data, and the history list containing the change tracking and filtering information. The history list has one row for each row in the normal list, together with a row for each row that has been deleted. Defining a list by any mechanism, or adding columns to a list, discards the history list, and turns off change tracking.

Properties

Object specific
$colcount Returns the number of columns in the list
$isfixed If true, the list has fixed length columns
Changing $isfixed clears the data and the class for the list, but keeps the column definitions (note that a list defined using $define() has columns of any length). Fixed length columns improve performance in some cases, but cannot contain all data types.
$line The current line in the list
This changes when the user clicks on a list line, or when using a method such as $search().
$linecount The number of lines in the list
You can change this property or use Set final line number to truncate the list.
$linemax The maximum number of lines in the list
This is set to 10,000,000 by default but you can change it to restrict the list size.
$smartlist If true, the list is a smart list
Setting $smartlist to kTrue creates and initializes the history list. If it is already kTrue, then setting it again has no effect.
Setting $smartlist to kFalse discards the history list completely. The current normal list remains unchanged, so the current contents of the normal list are preserved, but all history and filtering information is lost.
If you define or redefine a list using any mechanism, or add columns to a list, its $smartlist property is set to kFalse automatically.
Standard $desc $ident $name $sublen $subtype $type

Methods

Warning: SQL methods, $filter, $refilter, $unfilter, $search, $sort and $totc are not available in client methods.

Object specific
$add $add(columnValue,columnValue,...) inserts a new list line and returns an item reference to it
$addcols $addcols(cName,type,subtype,maxlen,...) adds 1 or more columns to a list or row. Specify each column with 4 parameters:cName,data type constant e.g.kCharacter (not kObject),subtype and maxlen
$clear $clear() clears the data for a list or row, or a column in a list or row; executing list.$clear() for a smart list sets $smartlist to kFalse, meaning that it is no longer a smart list
$copydefinition $copydefinition(listOrRow[,param...]) copies the definition of listOrRow to the calling list or row variable. If listOrRow contains a table instance the method passes param... to $construct of the new instance
$define $define([var1,var2,...]) defines a list or row;the columns have the names and types of the parameters.Each parameter can also be a file class name (a string) from which all columns are used;append /S to the file class name to skip empty columns
$definefromsqlclass $definefromsqlclass(sqlclass[,wRow,param,...]) clears and defines the list or row using the class,and creates a table instance passing param... to table $construct.wRow is a row of schema column names to use (no names means use all)
$filter $filter(searchCalculation) applies a filter to a smart list and returns the number of rows rejected from the list by the filter
$first $first([bSelectedOnly=kFalse, bBackwards=kFalse]) sets $line to first line defined by the parameters; returns an item reference to it.If bSelectedOnly is kTrue,only selected lines are processed; if bBackwards is kTrue,lines are processed in reverse
$includelines $includelines(kRowXxxx) specifies which lines are present in the normal list of a smart list
$merge $merge(lList,bByName,bSelectedOnly[,bClearDestList=kFalse]) merge two lists
$next $next(rRow | iRowNumber [,bSelectedOnly=kFalse, bBackwards=kFalse]) sets $line to the next line after the line identified by the first argument. If iRowNumber is zero, processing starts at $line. See $first for definitions of the other parameters
$redefine $redefine([var1,var2,...]) redefines a list or row variable with the names of the parameters.Each parameter can also be a file class name(a string) from which all columns are used;append /S to the file class name to skip empty columns
$refilter $refilter() reapplies all the current filters to a smart list
$remove $remove(rLine | iLineNumber | kListDeleteSelected | kListKeepSelected) deletes the specified lines from the list
$revertlistdeletes $revertlistdeletes() causes deletes made to the smart list to be reversed
$revertlistinserts $revertlistinserts() causes inserts made to the smart list to be removed
$revertlistupdates $revertlistupdates() causes updates made to the smart list to be reversed
$revertlistwork $revertlistwork() causes all deletes, inserts and updates made to the smart list to be reversed
$savelistdeletes $savelistdeletes() causes deletes made to the smart list to be made permanent
$savelistinserts $savelistinserts() causes inserts made to the smart list to be made permanent
$savelistupdates $savelistupdates() causes updates made to the smart list to be made permanent
$savelistwork $savelistwork() causes all deletes, inserts and updates made to the smart list to be made permanent
$search $search(calculation [,bFromStart=kTrue, bOnlySelected=kFalse, bSelectMatches=kTrue, bDeselectNonMatches=kTrue]) searches the list
$search searches a list using the specified calculation; this method has the same function as the Search list command. The search calculation can use $ref.colname or list_name.colname to refer to a list column. With bSelectMatches or bDeselectNonMatches the first line number whose selection state is changed is returned (or 0 if no selection states are changed), otherwise the first line number which matches the selection is returned (or 0 if no line is found). This method does not change any CRB values, the current line is changed if neither bSelectMatches or bDeselectNonMatches is used.
bOnlySelected restricts the search to selected lines. If bFromStart is kTrue, Omnis searches all of the lines in the list, starting at line 1; otherwise, Omnis starts the search at line ($line + 1).
$sort $sort(calculation,bDescending=kFalse,...) sorts the list
You can specify up to 9 sort fields, including the sort order flag. The sort fields or calculations can use $ref.colname or list_name.colname to refer to a list column. The sort order flag defaults to kFalse (that is, the sort is normally ascending). For calculated sorts, the calculation is evaluated for line 1 of the list to determine the comparison type (Character, Number or Date).
$totc $totc(expression[,bSelectedOnly=kFalse]) returns the total of the expression evaluated for either all lines in the list,or if bSelectedOnly is kTrue,all selected lines in the list
$unfilter $unfilter([iLevel]) removes a filter or filters from a smart list
Standard $addafter $addbefore $appendlist $insertlist $makelist $sendall

Children

$cols $filters $history