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.

<strong>Caché</strong> <strong>ObjectScript</strong> Functions$SELECTReturns the value associated with the first true expression.$SELECT(expression:value,...)$S(expression:value,...)ParametersexpressionvalueThe select test for the associated value parameter.The value to be returned if the associated expression evaluates totrue.DescriptionThe $SELECT function returns the value associated with the first expression that evaluatesto true (1). Each $SELECT argument is a pair of expressions separated by a colon. The lefthalf is a truth-valued expression. The right half can be any expression.The specified list of expression:value pairs can be of any length. $SELECT evaluates theparameters from left to right. When $SELECT discovers a truth-valued expression with thevalue of true (1), it returns the matching expression to the right of the colon. $SELECT stopsevaluation after it discovers the left-most true truth-valued expression. It never evaluates laterpairs on the parameter list.ParametersexpressionThe select test for the associated value parameter. It can be any valid <strong>Caché</strong> relational orlogical expression. If no expression evaluates to true, <strong>Caché</strong> generates a error.To prevent an error from disrupting an executing routine, the final expression can be the value1, which always tests true.valueThe value to be returned if the associated expression evaluates to true. It can be a numericvalue, a string literal, a variable name, or any valid <strong>Caché</strong> <strong>ObjectScript</strong> expression. If youspecify an expression for value, it is evaluated only after the associated expression evaluatesto true. If value contains a subscripted global reference, it changes the naked indicator whenit is evaluated. For this reason, be careful when using naked global references either within296 <strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!