Question
· Jul 26, 2023

How do I retrieve the name of the first GLOBAL from within the GLOBAL directory?

How do I retrieve the name of the first GLOBAL from within the GLOBAL directory?
Should I use some syntax with $Order or $Query or is there another way?

Discussion (3)1
Log in or sign up to continue

As others already wrote,

write $order(^$GLOBAL(""))

gives you the first global name accessible from a given namespace. Usually, this will be a percent-global (^%...) but if you want to get the first (or all) global, which resides in a given database, the do the same as above but with extended global access

set dir = "^^c:\databases\mydb\"  // "^^" and "the path to your CACHE/IRIS.dat file"
write $order(^$|dir|GLOBAL(""))