How to find a global's original namespace ? Potentially mapped from a different namespace
How to find a global's original namespace ? Potentially mapped from a different namespace .
I have a global ^Custom that exists in multiple namespaces but it could mapped from namespace Drone(A) to Launch(B)
Without access to Cache management portal how to find where is my global located using cache code ?
Like if ^Custom == ^[Drone]Custom ??
Product version: Caché 2018.1
See %SYS.GlobalQuery_NameSpaceList().
Example:
The %SYS.Namespace class contains the methods, you are looking for.
write ##class(%SYS.Namespace).GetGlobalDest( [namspace], "global") --> DB where the global lies write ##class(%SYS.Namespace).GetRoutineDest( [namspace], "routine") --> DB where the routine lies write ##class(%SYS.Namespace).GetPackageDest( [namspace], "package") --> DB where the package lies
Thank you.. this works
Bharathsimha,
your initial question should be reformulated as "how to find global's [main] database" because all namespaces have "equal rights" for any global which is visible from (= mapped to) them.
Julias is quite correct in his answering, but you should take into account that it concerns the global's main database only. If global subscript mapping is used, the full solution to get the list of all databases where the global is partially mapped is a more tricky task. If somebody is interested, I can write about how I solved it once.
Thank you for the details.. we have only one global that has node specific mapping while most of them are whole globals and the solution suggested above works.
For the single node since our data part varies across namespace it is evident of being sourced locally.
Thank you so much.