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?
Comments
Hello @Sukhpreet Singh,
You can use the global mapping in "%ALL" namespace.
This is the most convenient way.
A Global name starting with % can be accessible from any namespace
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 functionskill ^|dir|myglobal(1)
write$order(^|dir|myglobal(1,2))
set isDef = $data(^|dir|myglobal)