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.

• To delete a selected node within a local variable array, you must use an inclusive KILL.• To delete a global variable array, you must use an inclusive KILL.• To delete a selected node within a global variable array, you must use an inclusive KILL.To delete an array, simply supply its name to an inclusive KILL. For example, the followingcommand deletes global array ^fruitbasket and all of its subordinate nodes.SET ^fruitbasket(1)="fruit"SET ^fruitbasket(1,1)="apples"SET ^fruitbasket(1,2)="oranges"WRITE !,^fruitbasket(1)," contains ",^fruitbasket(1,1)," and ",^fruitbasket(1,2)KILL ^fruitbasketWRITE !,"Try to display array values"WRITE !,^fruitbasket(1),!,^fruitbasket(1,1),!,^fruitbasket(1,2)QUITTo delete an array node, supply the appropriate subscript. For example, the following KILLcommand deletes the node at subscript 1,2.SET ^fruitbasket(1)="fruit"SET ^fruitbasket(1,1)="apples"SET ^fruitbasket(1,2)="oranges"SET ^fruitbasket(1,2,1)="navel"SET ^fruitbasket(1,2,2)="mandarin"WRITE ^fruitbasket(1)," contains ",^fruitbasket(1,1)," and ",^fruitbasket(1,2),!WRITE ^fruitbasket(1,2)," contains ",^fruitbasket(1,2,1)," and ",^fruitbasket(1,2,2),!KILL ^fruitbasket(1,2)WRITE "1st level node: ",^fruitbasket(1),!WRITE "2nd level node: ",^fruitbasket(1,1),!WRITE "Deleted 2nd level node: ",^fruitbasket(1,2),!WRITE "3rd level node under deleted 2nd: ",^fruitbasket(1,2,1),!QUITWhen you delete an array node, you automatically delete all nodes subordinate to that nodeand any immediately preceding node that contains only a pointer to the deleted node. If adeleted node is the only node in its array, the array itself is deleted along with the node.To delete multiple local variable arrays, you can use either the inclusive form or exclusiveform of KILL, as described above. For example, the following command removes all localarrays except array1 and array2.KILL (array1,array2)To delete multiple array nodes, you can use only the inclusive form of KILL. For example,the following command removes the three specified nodes, deleting one node from each array.KILL array1(2,4),array2(3,2),array3(1,7)KILL<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 77

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

Saved successfully!

Ooh no, something went wrong!