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.

$LISTBUILDresults of $LISTBUILD are often best displayed using the ZZDUMP command. SeeZZDUMP for examples of $LISTBUILD involving non-printing and Unicode characters.Note:$LISTBUILD and the other $LIST functions use an optimized binary representationto store data elements. For this reason, equivalency tests may not work as expectedwith some $LIST data. Data that might, in other contexts, be considered equivalent,may have a different internal representation. For example, $LISTBUILD(1) is notequal to $LISTBUILD(“1”).For the same reason, a list string value returned by $LISTBUILD should not beused in character search and parse functions that use a delimiter character, such as$PIECE and the two-argument form of $LENGTH. Elements in a list created by$LISTBUILD are not marked by a character delimiter, and thus can contain anycharacter.ExamplesThe following example produces the three-element list "Red,Blue,Green":SET X=$LISTBUILD("Red","Blue","Green")WRITE !,$LIST(X,1,3)NotesOmitting ParametersOmitting an element expression yields an element whose value is undefined. For example,the following $LISTBUILD statement produces a three-element list whose second elementhas an undefined value; referencing the second element with the $LIST function will producea error.WRITE $LIST($LISTBUILD("Red",,"Green"),2)However, the following produces a three-element list whose second element is a null string.No error condition exists.WRITE $LIST($LISTBUILD("Red","","Green"),2)Additionally, if a $LISTBUILD expression is undefined, the corresponding list element hasan undefined value. The following two expressions both produce the same two-element listwhose first element is "Red" and whose second element has an undefined value:WRITE !,$LISTBUILD("Red",)KILL ZWRITE !,$LISTBUILD("Red",Z)<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 245

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

Saved successfully!

Ooh no, something went wrong!