11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

the command if the postconditional expression is false (evaluates to zero). For further details,refer to Command Postconditional Expressions in Using <strong>Caché</strong> <strong>ObjectScript</strong>.destination and sourceVariables to be merged. Either variable can be a local variable, a process-private global, ora global. If destination is undefined, MERGE defines it and sets it to source. If source isundefined, MERGE completes successfully, but does not change destination.You can specify multiple, comma-separated destination=source pairs. They are evaluated inleft-to-right order.ExamplesThe following example copies a subtree from one global variable (^a) to another globalvariable (^b). In this case, the merge is being used to create a smaller global ^b, which containsonly the ^a(1,1) subtree of the information in ^a.SET ^a="cartoons"SET ^a(1)="The Flintstones",^a(2)="The Simpsons"SET ^a(1,1)="characters",^a(1,2)="place names"SET ^a(1,1,1)="Flintstone family"SET ^a(1,1,1,1)="Fred"SET ^a(1,1,1,2)="Wilma"SET ^a(1,1,2)="Rubble family"SET ^a(1,1,2,1)="Barney"SET ^a(1,1,2,2)="Betty"MERGE ^b=^a(1,1)WRITE ^b,!,^b(2),!,^b(2,1)," and ",^b(2,2)The following example shows how a destination global variable looks after it has been mergedwith a sub-tree of a source global variable.Suppose you execute the following:KILL ^X,^YSET ^X(2,2)="first"SET ^X(2,2,4)="second"SET ^Y(3,6,7)="third"SET ^Y(3,6,8)="fourth"SET ^Y(3,6,7,8,4)="fifth"SET ^Y(3,6,7,8,9)="sixth"WRITE ^X(2,2),!,^X(2,2,4),!WRITE ^Y(3,6,7),!,^Y(3,6,8),!WRITE ^Y(3,6,7,8,4),!,^Y(3,6,7,8,9)The following figure shows the resulting logical structure of ^X and ^Y.MERGE<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 91

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!