12.07.2015 Views

Using Caché Globals - InterSystems Documentation

Using Caché Globals - InterSystems Documentation

Using Caché Globals - InterSystems Documentation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> Multidimensional Storage (<strong>Globals</strong>)3.4 Retrieving the Value of a Global NodeTo get the value stored within a specific global node, simply use the global reference as an expression.<strong>Using</strong> <strong>Caché</strong> Basic:color = ^Data("Color") ' assign to a local variablePrint ^Data("Color") ' use as an argument to a commandMyMethod(^Data("Color")) ' use as a function argument<strong>Using</strong> <strong>Caché</strong> ObjectScript:SET color = ^Data("Color") ; assign to a local variableWRITE ^Data("Color"); use as a command argumentSET x=$LENGTH(^Data("Color")) ; use as a function parameter3.4.1 The $GET FunctionWithin <strong>Caché</strong> ObjectScript, you can also get the value of a global node using the $GET function:SET mydata = $GET(^Data("Color"))This retrieves the value of the specified node (if it exists) or returns the null string ("") if the node isundefined. You can use the optional second argument of $GET to return a specified default value ifthe node is undefined.3.4.2 The WRITE, ZWRITE, and ZZDUMP CommandsYou can display the contents of a global or a global subnode by using the various <strong>Caché</strong> ObjectScriptdisplay commands. The WRITE command returns the value of the specified global or subnode as astring. The ZWRITE command returns the name of the global variable and its value, and each of itsdescendant nodes and their values. The ZZDUMP command returns the value of the specified globalor subnode in hexadecimal dump format.3.5 Traversing Data within a GlobalThere are a number of ways to traverse (iterate over) data stored within a global.20 <strong>Using</strong> <strong>Caché</strong> <strong>Globals</strong>

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

Saved successfully!

Ooh no, something went wrong!