Question
· Jan 14, 2020

Getting dynamic object from iterator

Is there a way to get dynamic object from iterator?

set arr=[1,2,3]
set iter=arr.%GetIterator()

I pass iterator several frames down and I'd rather avoid passing both the array and iterator, but for debugging I need to access original object in a situation where only iterator is available.

Is there a way to do it?

Discussion (5)0
Log in or sign up to continue

Looks like there's a pvaoref property that points to the original instance as you can see below:

Method %OnNew(oref As %Library.DynamicAbstractObject) As %Status [ Private, ProcedureBlock = 1, ServerOnly = 1 ]
{
    set i%pointer = -1
    set ..pvaoref = oref
    return $$$OK
}

And it seems to work:

USER>set a = []

USER>set it = a.%GetIterator()

USER>w it.pvaoref
1@%Library.DynamicArray
USER>