Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

Merge

Merges array elements from source to target.

Synopsis

Merge target=source

Arguments

The Merge statement has the following parameters:

source The name of the variable, typically an array, which should be merged into the target variable.
target The name of the variable into which the contents of source should be merged.

Description

Nodes in the source variable overwrite corresponding nodes in the target variable, and all descendents of source overwrite corresponding descendents of target. All other target nodes are unchanged. The only difference between Copy and Merge is that Copy deletes the target nodes, and Merge does not.

Examples

Erase source, target

target(1) = "node 1"
target(1,1) = "node 1,1"
target(2) = "node 2"
target(3,1) = "node 3,1"
source(3,2) = "node 3,2"

Merge target=source

Println Exists(target(3,1)) 'is still defined, returns 1
Println Exists(target(3,2)) 'does now exist, returns 1
Copy code to clipboard

See Also