Eduard Lebedyuk · 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?

0 0 5 186


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

I get this error on access:


And the property is indeed marked as private.


I should have expected that much. Which version are you using?