Caché Basic Reference
Copy
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Copies array elements from source to target.
Synopsis
Copy target=source
Arguments
The Copy statement has the following parameters:
source The name of the variable, typically an array, which should be copied.
target The name of the variable into which the contents of source should be copied.
Description
All nodes in the target variable are deleted prior to the copy process. The only difference between Copy and Merge is the deletion of the target nodes.
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"

Copy target = source

Println Exists(target(3,1)) 'not defined anymore, returns 0
Println Exists(target(3,2)) 'does now exist, returns 1
Println Exists(target(1))   'not defined and has no subnodes, returns 0
See Also