JoinArrays (open)

Join two record arrays

Syntax

LOADLIB "wh::util/algorithms.whlib";

RECORD ARRAY FUNCTION JoinArrays(RECORD ARRAY lhs, STRING joincellname, RECORD ARRAY rhs, RECORD baserecord, RECORD options)

Parameters

RECORD ARRAY lhs

The record array to join data into

STRING joincellname

The cell in lhs on which to join the arrays

RECORD ARRAY rhs

The array to join with

RECORD baserecord

The structure of the cells of the rhs to merge. If default, all cells of rhs will be merged into lhs (except for the cell named 'joincellname', if no explicit joinfield is set). Otherwise, only cells named in this record will be copied to lhs

RECORD options

Options

joinfield

The field in the rhs array to use for the join. If not set, the joincellname is used

leftouterjoin

Perform a left outer join (too). If any rhs records do not have a match in lhs, it will be merged with this record

presentfield

If set, this field will contain 'left', 'right' or 'both' depending on which records were present

rightouterjoin

Perform a right outer join. If any lhs record does not have a match in rhs, it will be merged with the baserecord. If rightouterjoin is not set (the default), any unmatched records in lhs will be removed

Return value

RECORD ARRAY

rhs joined into lhs. The ordering of the lhs array will not change