What is the current preferred method for enumerating the globals in a namespace?
-
25-05-2021 - |
Question
I used to look at the source for %G for this, but lately Intersystems has stopped distributing the .INT code. I guess in theory I could use an eXecute statement in a loop to check $D on every legal global name but that's silly and unreasonably slow.
So what is currently the right way to do it?
Solution
use special global variable ^$GLOBAL
for example:
s global=""
f {
s global=$o(^$G(global))
q:global=""
zw global
}
OTHER TIPS
You could always use the class query in %SYS.GlobalQuery.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow