Now let's look again at ^PersonI
. In the example, even though ^PersonI
can have up to four subscripts, we're traversing the children of the root: the first dimension. Traverse()
returns the first valid subscript, in this case, DOB
. Passing DOB
as the subscript in turn returns the next valid subscript, Name
. Passing Name
, and passing Phone
to return the empty string.
When we use Traverse()
to traverse this level, it returns one of each subscript. In the view shown here, DOB
, 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.
examples on the next six pages (including this one) only run after you've stored at least one person in the database, in the SAMPLES
namespace, as the hands-on exercises specify.
println "first node of ^PersonI is: ", traverse( ^PersonI("") )
println "node after ""DOB"" is: ", traverse( ^PersonI("DOB") )
println "node after ""Name"" is: ", traverse( ^PersonI("Name") )
println "node after ""Phone"" is: ", traverse( ^PersonI("Phone") )
© 1997-2019 InterSystems Corporation, Cambridge, MA