Question
· Jul 15, 2023

Is there any way to create a global that will be available in all the namespaces?

I want to fetch value from a global without being limited by the namespace.  Is there any way of referencing the values from a global to a different namespace?

Product version: IRIS 2023.1
Discussion (3)2
Log in or sign up to continue

As an addition to the above possibilities, you can  ALWAYS use (assumed, you have the rights to access the database where the global lives - this is true for both of the above too) extended global access.

Just one remark, this kind of access is possible but not the recommended way for creating regular classes (databases) rather to occasionally (on demand) access data from other namespace and/or namespaces.

set nsp = "USER"
set myvar = ^|nsp|MyGlobal(1,2,3)

If there is no namespace associated with the database (where the global lives) just use the implicit namespace

set dir = "^^C:\mydatabases\myfolder\"    // win-world, "^^pathToTheDatabase"
set dir = "^^/opt/mydatabases/myfolder/"  // unix-world, 
write ^|dir|myglobal(1,2,3)

// and, of course all other commands and functions
kill ^|dir|myglobal(1)
write $order(^|dir|myglobal(1,2))
set isDef = $data(^|dir|myglobal)