Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

Working With Indices

generated description: personi

Now let's look again at ^PersonI and $Order. In the example, even though ^PersonI can have up to four subscripts, we're traversing the children of the root: the first dimension. $Order returns the first valid subscript, in this case, “DOB”. Passing “DOB” as the subscript in turn returns the next valid subscript, “Name”. Passing “Name” returns “Phone”, and passing “Phone” causes $Order to return the empty string.

When we use $Order to traverse this level, it returns one of each subscript. In the view shown here, “DOB”, “Name”, and “Phone” repeat three times. This isn't an error, it's just the Portal's way of displaying globals. There is only one “DOB” node, one “Name” node, and one “Phone” node in the tree.

SAMPLES>write $order( ^PersonI("") )
DOB
SAMPLES>write $order( ^PersonI("DOB") )
Name
SAMPLES>write $order( ^PersonI("Name") )
Phone
SAMPLES>write $order( ^PersonI("Phone") )

SAMPLES>
FeedbackOpens in a new tab