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.

See Also• $ZWIDTH function$ZPREVIOUS$ZPREVIOUSReturns the previous array node subscript for the specified variable.$ZPREVIOUS(variable)$ZP(variable)ParametervariableName of local or global array variable or the null string. It can be specifiedas a value, a variable, or an expression.Description$ZPREVIOUS returns the previous array node subscript for the specified variable.$ZPREVIOUS is similar to the $ORDER function, except that it returns the previous, ratherthat the next, subscript in the collation sequence.You can use it to traverse a global in reverse subscript order. To start at the last subscript ona given level, specify the null string for the subscript reference. $ZPREVIOUS returns thenull string after it returns the first subscript on the root level.As with $ORDER, you can use $ZPREVIOUS on both local and global variables.Use of $ZPREVIOUS is discouraged. Rather, use the form $ORDER(variable,-1).ExampleGiven the array node definitions shown, and starting with the last subscript, $ZPREVIOUSreturns the following results:SET ^ABC(1)=1SET ^ABC(2)=2SET ^ABC(3)=3SET x=$ZPREVIOUS(^ABC("")) ; 3WRITE !,"Third is ",xSET x=$ZPREVIOUS(^ABC(x)) ; 2WRITE !,"Second is ",xSET x=$ZPREVIOUS(^ABC(x)) ; 1WRITE !,"First is ",xSET x=$ZPREVIOUS(^ABC(x)) ; ""WRITE !,"Top is ",x<strong>Caché</strong> <strong>ObjectScript</strong> <strong>Reference</strong> 555

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

Saved successfully!

Ooh no, something went wrong!