UnionSelection (sel1, sel2 | searchxExprText, [sortExpr], [descending])

Result Type: Selection

Definition: Creates a union of the two selections (which must be from the same internal file). The second parameter can be specified as an existing selection, or as a search that results in a selection. The resultant selection can be optionally sorted in the same way as createSelection().

Example:  If sel1 is a selection created by

createSelection("transaction", "type=`CP`"),

i.e. of cash payments

unionSelection(sel1, "type=`CR`")

returns a selection containing both cash payments and receipts, and is equivalent to createSelection("transaction", "type=`CP` or type = `CR`)

unionSelection(sel1, "type=`CR`", "transdate")

Same as previously, except the selection is sorted into ascending order of transaction date (for descending order, pass a fourth parameter with a value of 1).

See Also:

CreateSelection: Create a selection of records

DisplaySelection: Display standard list window for a given selection of records

IntersectSelection: Intersect a selection with the result of another search

RecordsSelected: Count records in a selection or resulting from a (meta) search

SumDetail: Add up a field for details matching a search

SumSelection: Add up a field for records matching a search