Skip to main content

Working With Indexes

PersonI global showing 4 persons in the DOB, Name, and Phone indexes, and in a bitmap index

Now let's look again at ^PersonI. In the $Order example below, even though ^PersonI can have up to four subscripts, $Order is traversing the children of the root: the first dimension.

  • Passing the empty string to $Order returns the first valid subscript, in this case, “Bitmap-ID”.

  • Passing “Bitmap-ID” returns “DOB”.

  • Passing “DOB” returns “Name”.

  • Passing “Name” returns “Phone”.

  • Passing “Phone” causes $Order to return the empty string.

When you use $Order to traverse this level, it returns one of each subscript. In the view shown above, “DOB”, “Name”, and “Phone” repeat four 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.

Terminal


USER>write $order(^PersonI(""))
Bitmap-ID
USER>write $order(^PersonI("Bitmap-ID"))
DOB
USER>write $order(^PersonI("DOB"))
Name
USER>write $order(^PersonI("Name"))
Phone
USER>write $order(^PersonI("Phone"))

USER>
FeedbackOpens in a new tab