11.07.2015 Views

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - InterSystems Documentation

Caché ObjectScript Reference - 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.

$ZREFERENCESET ^MyData(1)="fruit"SET ^MyData(1,1)="apples" ; Full global referenceSET ^(2)="oranges" ; Naked global reference,; implicitly ^MyData(1,2)WRITE !,$ZREFERENCE ; Returns "^MyData(1,2)"For further details on naked global references, see Using <strong>Caché</strong> Multi-Dimensional Storage(Globals) in Using <strong>Caché</strong> Multi-Dimensional Storage.If a command references a global variable using an extended global reference, the$ZREFERENCE value contains that extended global reference. <strong>Caché</strong> returns an extendedglobal reference in either of the following circumstances:• The current namespace differs from that of the last global reference.• The current global reference is a remote reference.For further details on global subscripts and extended global references, see Global Structurein Using <strong>Caché</strong> Multi-Dimensional Storage.Operations that Update $ZREFERENCEThe $ZREFERENCE special variable is initialized to the null string (""). Changing thecurrent namespace resets $ZREFERENCE to the null string.The following operations set $ZREFERENCE to the most recently referenced global:• A command or function that uses a global as an argument. If it uses multiple globals,$ZREFERENCE is set to the rightmost occurrence of a global.• A command that uses a global as a postconditional expression.• Following a ZWRITE, <strong>Caché</strong> sets $ZREFERENCE to the last listed subscript versionof the specified global reference.• A command or function that references an undefined global, and either generates an error, or, in the case of $INCREMENT, defines the global.Setting $ZREFERENCEYou can set this special variable using the SET command, as follows:• Set to the null string (""). Doing so deletes the naked indicator. If the next global referenceis a naked global reference, <strong>Caché</strong> issues a error.• Set to a valid global reference (defined or undefined). This causes subsequent nakedreferences to use the value you set as if it were the last actual global reference.<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 485

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

Saved successfully!

Ooh no, something went wrong!