ObjectScript Tutorial
Working With Indices
[Home] [Back] [Next]
InterSystems: The power behind what matters   

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("") )
SAMPLES>write $order( ^PersonI("DOB") )
SAMPLES>write $order( ^PersonI("Name") )
SAMPLES>write $order( ^PersonI("Phone") )


Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA