Returns the previous array node subscript for the specified variable.
||Name of local or global array variable or the null string. It can be specified as a value, a variable, or an expression.
This page describes the legacy function $ZPREVIOUS
. It is described here for compatibility with legacy applications. Use of $ZPREVIOUS
is discouraged. Rather, use the form $ORDER
returns the previous array node subscript for the specified variable. $ZPREVIOUS
is similar to the $ORDER
function, except that it returns the previous, rather that 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 on a given level, specify the null string for the subscript reference. $ZPREVIOUS
returns the null string after it returns the first subscript on the root level.
Given the array node definitions shown, and starting with the last subscript, $ZPREVIOUS
returns the following results:
SET x=$ZPREVIOUS(^ABC("")) ; 3
WRITE !,"Third is ",x
SET x=$ZPREVIOUS(^ABC(x)) ; 2
WRITE !,"Second is ",x
SET x=$ZPREVIOUS(^ABC(x)) ; 1
WRITE !,"First is ",x
SET x=$ZPREVIOUS(^ABC(x)) ; ""
WRITE !,"Top is ",x