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> FunctionsdefaultIf you omit the default parameter, the null string ("") is assumed for the default value.ExamplesThe $LISTGET functions in the following example both return “A”, the first element in thelist:SET LIST=$LISTBUILD("A","B","C")WRITE !,$LISTGET(LIST)WRITE !,$LISTGET(LIST,1)The $LISTGET functions in the following example both return “C”, the third and last elementin the list:SET LIST=$LISTBUILD("A","B","C")WRITE !,$LISTGET(LIST,3)WRITE !,$LISTGET(LIST,-1)The $LISTGET functions in the following example both return a value upon encounteringthe undefined 2nd element in the list. The first returns a question mark (?), which the userdefined as the default value. The second returns a null string because a default value is notspecified:WRITE !,$LISTGET($LISTBUILD("A",,"C"),2,"?")WRITE !,$LISTGET($LISTBUILD("A",,"C"),2)The $LISTGET functions in the following example both specify a position greater than thelast element in the three-element list. The first returns a null string because the default valueis not specified. The second returns the user-specified default value, “ERR”:SET LIST=$LISTBUILD("A","B","C")WRITE !,$LISTGET(LIST,4)WRITE !,$LISTGET(LIST,4,"ERR")The $LISTGET functions in the following example both return a null string:SET LIST=$LISTBUILD("A","B","C")WRITE !,$LISTGET(LIST,0)WRITE !,$LISTGET("")NotesInvalid Parameter ValuesIf the expression in the list parameter does not evaluate to a valid list, a error canoccur.254 <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!