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.

If the value of the position parameter or the end parameter is less than -1, invoking the $LISTfunction generates a error.If the value of the position parameter refers to a nonexistent list member and no end parameteris used, invoking the $LIST function generates a error.SET LIST2=$LISTBUILD("Brown","Black")ZZDUMP $LIST(LIST2,3) ; generates a NULL VALUE errorSET x=$LIST(LIST2,0) ; generates a NULL VALUE errorIf the value of the position parameter identifies an element with an undefined value, invokingthe $LIST function also generates a error.ZZDUMP $LIST("") ; generates a NULL VALUE errorSET X=$LISTBUILD("A",,"C")ZZDUMP $LIST(X,2) ; generates a NULL VALUE errorTwo-Parameter and Three-Parameter $LIST$LIST(list,1) is not equivalent to $LIST(list,1,1) because the former returns a string, whilethe latter returns a single-element list string. Furthermore, the first can receive a error, whereas the second cannot; if there are no elements to return, it returns anull string.UnicodeIf one Unicode character appears in a list element, that entire list element is represented asUnicode (wide) characters. Other elements in the list are not affected.The following example shows two lists. The y list consists of two elements which containonly ASCII characters. The z list consists of two elements: the first element contains a Unicodecharacter ($CHAR(960) = the pi symbol); the second element contains only ASCII characters.SET y=$LISTBUILD("ABC"_$CHAR(68),"XYZ")SET z=$LISTBUILD("ABC"_$CHAR(960),"XYZ")WRITE !,"The ASCII list y elements: "ZZDUMP $LIST(y,1)ZZDUMP $LIST(y,2)WRITE !,"The Unicode list z elements: "ZZDUMP $LIST(z,1)ZZDUMP $LIST(z,2)Note that <strong>Caché</strong> encodes the first element of z entirely in wide Unicode characters. The secondelement of z contains no Unicode characters, and thus <strong>Caché</strong> encodes it using narrow ASCIIcharacters.See Also• $LISTBUILD function$LIST<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 243

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

Saved successfully!

Ooh no, something went wrong!