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.

$GETIF $GET(^client(i))="" { QUIT }ELSEIF $GET(^client(i))="" {WRITE !!,"Name: No Data"GOTO Level1+3}The two lines perform different actions depending on whether the array element is undefinedor a downward pointer without data. If $GET were used here, only the first action (QUIT)would ever be performed. You could use $DATA for the first test and $GET for the second,but not the reverse ($GET for the first test and $DATA for the second).Defaults with $GET and $SELECT$GET(variable,default) allows you to return a default value when a specified variable isundefined. The same operation can be performed using a $SELECT function.However, unlike $SELECT, the second argument in $GET is always evaluated.The fact that $GET always evaluates both of its arguments is significant if variable anddefault both make subscripted global references and thus both modify the naked indicator.Because the arguments are evaluated in left-to-right sequence, the naked indicator is set tothe default global reference, regardless of the whether $GET returns the default value. Forfurther details on using $GET with global variables and the naked indicator, see Using Multi-Dimensional Storage (Globals) in Using <strong>Caché</strong> Multi-Dimensional Storage.Handling Undefined Variables$GET defines handling behavior if a specified variable is undefined. The basic form of $GETreturns a null string ("") if the specified variable is undefined.$DATA tests if a specified variable is defined. It returns 0 if the variable is undefined.The $ZUTIL(18) function defines handling behavior for all undefined variables for the currentprocess. The $ZUTIL(69,0) function defines handling behavior for all undefined variablessystem-wide. Setting $ZUTIL(18) or $ZUTIL(69,0) has no effect on $GET or $DATAhandling of specified variables.See Also• $DATA function• $SELECT function• $ZUTIL(18) Set Undefined Variable Handling function• $ZUTIL(69,0) Set Undefined Variable Handling System-wide function• Using Multi-Dimensional Storage (Globals) in Using <strong>Caché</strong> Multi-Dimensional Storage<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 219

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

Saved successfully!

Ooh no, something went wrong!