· Jun 4

Global Variable Map

When developing productions there are many places that we input endpoint information (IP/port) especially when there are dozens of operations going to the same environment. What later happens is that the IP changes and we have to then go into each operation and update the IP.

Is there a way to create a "global variable" for an endpoint, something like `$ehr_IP` and then use that and update it in a single place?

I'm aware of defaults, but I don't want a default as this is not a "default" but is the value to use in place of the variable.

Context: I'm very new to InterSystems Health Connect but experienced working with other Interface Engines such as Mirth Connect, and they had this concept of a global variable map.

Discussion (5)2
Log in or sign up to continue

The better approach here, if you don't want to use SystemDefaults.

Is to add a global mapping for your global config variable ^ehrIP to the %ALL namespace pointing it to a config database. This will point the ^ehrIP global in each namespace to the same storage location.

Then you can access this global via ^ehrIP as usual. I would not use % globals as they are saved in the %SYS namespace and application code/data should not be living in the %SYS namespace.

@Timo Lindenschmid Thank you for that, so I'm working with two guys already experienced and they helped to create the global config variables. And it works in terminal, but not in a production service/process/operations settings. Here is what we are trying to do:

But no matter what kind of formatting we try to put in this "IP Address" field, we cannot get it to parse and get the mapped value. Any ideas?

ERROR <Ens>ErrOutConnectExpired: TCP Connect timeout period (5) expired for ^epicTST:5117

I don't think you can provide object script code via the UI for security reasons.

What you probably need to do is open you production item in Studio/VSCode.

Then overwrite the OnInit() method with something like

Below code is not validated and will not be 100% correct in regard to function specs etc, this is only used for clarification and example:

Method OnInit(.............) as %Status
    set ..IpAddress=$get(^ehrIP)
    set status=#super()
    return status