Merge list

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

Syntax

Merge list list-or-row-name ([Clear list][,Use search])

Options

Clear list If specified, the command empties the current list and defines it to match the specified list before executing
Use search If specified, the command uses the current search to select data

Description

This command adds the specified list to the end of the list previously specified as the current list. Once the list reaches its maximum size, the command finishes and clears the flag. Omnis does not check that the same fields are stored in the two lists (which they should be). If the same fields are not present, data is not transferred.

If you use the Clear list option, the current list is initially cleared and defined to hold the same fields as the specified list. This is the same as copying a list.

If you use the Use search option, only lines matching the search class are merged or added to the current list. All lines match if there is no current search class.

Example

; To merge the list iList1 to the current list iList2
Set current list iList2
Set search name sMySearch
Merge list iList1 (Clear list,Use search)
If flag true
  Sort list
Else
  OK message {Merge failed at line [iList1.$linecount]}
End If
; To append only selected lines
; or do it like this
Do iList2.$merge(iList1)