Question
· Sep 27, 2021

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
Discussion (5)0
Log in or sign up to continue

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

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.