Question
· Apr 8

Sharing lookup tables between namespaces

Hi everyone.

Is there a sensible approach to having a lookup table in Namespace A, and then accessing this from Namespaces B, C, D (etc)?

I'm trying to avoid creating a Global mapping of the lookup table global (^Ens.LookupTable) as I fear that it would then link all other lookups in that global and lead to some unexpected behaviour, but would be open to trying something in this realm if it's the best option.

Another approach I have considered is creating a custom lookup function that is run from the secondary namespaces that does some namespace hopping, but it feels messy. Something like:

//Get current namespace name
Set curr = $ZNSPACE

//Switch to namespace A
ZN "A"

// Code to access data in lookup goes here


//Switch back to original namespace
ZN curr

Quit $$$OK
Discussion (4)2
Log in or sign up to continue

You can map a subscript of Ens.LookupTable, rather than map all of Ens.LoopTable, to restrict the mapping to only the lookup table you want to map.

Simply set the 'Global Subscripts to be Mapped' setting, in the Global Mapping, to the lookup table you want to map, enclosed in brackets and double quotes, e.g.: ("TableA").
Repeat this for each table you want to map.

Hope this helps.

Neil

As intimated you can map the lookup tables at the base global.

We do this because we have many productions all requiring the same set of lookup tables. We also have common credentials across all our namespaces as shown in the above above global mappings

We also use a common database to store all of our code to enhance code reuse and reduce copying of classes across namespaces.