12.07.2015 Views

Using Caché Globals - InterSystems Documentation

Using Caché Globals - InterSystems Documentation

Using Caché Globals - 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.

Testing the Existence of a Global NodeFor example, the <strong>Caché</strong> ObjectScript statement:KILL ^Datadeletes the entire ^Data global. A subsequent reference to this global would return an error.The <strong>Caché</strong> ObjectScript statement:KILL ^Data(100)deletes contents of node 100 within the ^Data global. If there are descendant subnodes, such as^Data(100,1), ^Data(100,2), and ^Data(100,1,2,3), these are deleted as well.The <strong>Caché</strong> ObjectScript ZKILL command deletes a specified global or global subscript node. It doesnot delete descendant subnodes.You cannot use the NEW command on global variables.3.3 Testing the Existence of a Global NodeTo test if a specific global (or its descendants) contains data, use the <strong>Caché</strong> ObjectScript $DATAfunction.$DATA returns a value indicating whether or not the specified global reference exists. The possiblereturn values are:StatusValue011011MeaningThe global variable is undefined.The global variable exists and contains data, but has no descendants. Notethat the null string ("") qualifies as data.The global variable has descendants (contains a downward pointer to asubnode) but does not itself contain data. Any direct reference to such avariable will result in an error. For example, if $DATA(^y)returns 10, SET x=^y will produce an error.The global variable both contains data and has descendants (contains adownward pointer to a subnode).<strong>Using</strong> <strong>Caché</strong> <strong>Globals</strong> 19

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

Saved successfully!

Ooh no, something went wrong!