Store config settings in global

19 views
Skip to first unread message

RR

unread,
Apr 7, 2016, 5:34:11 PM4/7/16
to InterSystems: Ensemble in Healthcare
Hi,
I am using EnsLib.HL7.Operation.TCPOperation to connect to external IP. Currently the IP address and port are stored in the production class (settings) itself.  
I would like to see if we can store those in a global variable so that it can be set based on environment. Appreciate any suggestion on how this can be done. 

Thanks
RR

Lori Fassman

unread,
Apr 7, 2016, 5:55:58 PM4/7/16
to Ensemble-in...@googlegroups.com
You can use Ensemble's System Default Settings to store information that's environment specific:

Inline image 1

Another thing you can do is create an Ensemble lookup table (or your own custom SQL table, whatever you prefer) that keeps environment-specific data, which you can call from your operation:

Inline image 2


If you're using the Ensemble lookup tables, you can refer to the native data on disk (Set tVariable = $get(^Ens.LookupTable("tableName","variableName")) or you can use the Ensemble Lookup function:

Set tVariable = ##class(Ens.Util.FunctionSet).Lookup("tableName","variableName")

Lori




Lori Fassman
Ready Computing

Out of office:
Thursday April 14: 1-5pm


--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.
To post to this group, send email to Ensemble-in...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healt...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.
To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healt...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Loveluck

unread,
Apr 7, 2016, 6:17:36 PM4/7/16
to Ensemble-in...@googlegroups.com

This is exactly the problem that System Default Settings are designed to handle

 

See the documentation at

 

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=ECONFIG_other#ECONFIG_other_default_settings

 

Dave

--

RR

unread,
Apr 8, 2016, 9:10:04 AM4/8/16
to InterSystems: Ensemble in Healthcare
Thanks Lori and Dave. System Default Settings helps. 


On Thursday, April 7, 2016 at 6:17:36 PM UTC-4, David Loveluck wrote:

This is exactly the problem that System Default Settings are designed to handle

 

See the documentation at

 

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=ECONFIG_other#ECONFIG_other_default_settings

 

Dave

 

From: ensemble-in...@googlegroups.com [mailto:ensemble-in-healt...@googlegroups.com] On Behalf Of RR
Sent: Thursday, April 07, 2016 5:35 PM
To: InterSystems: Ensemble in Healthcare
Subject: [InterSystems-EnsHlth] Store config settings in global

 

Hi,

I am using EnsLib.HL7.Operation.TCPOperation to connect to external IP. Currently the IP address and port are stored in the production class (settings) itself.  

I would like to see if we can store those in a global variable so that it can be set based on environment. Appreciate any suggestion on how this can be done. 

 

Thanks

RR

--
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare Community" group.

To post to this group, send email to Ensemble-i...@googlegroups.com
To unsubscribe from this group, send email to Ensemble-in-Healthcare-unsub...@googlegroups.com


For more options, visit this group at http://groups.google.com/group/Ensemble-in-Healthcare?hl=en
---
You received this message because you are subscribed to the Google Groups "InterSystems: Ensemble in Healthcare" group.

To unsubscribe from this group and stop receiving emails from it, send an email to Ensemble-in-Healthcare+unsub...@googlegroups.com.

Lawrence Harris

unread,
Apr 8, 2016, 1:43:10 PM4/8/16
to InterSystems: Ensemble in Healthcare
In my file operation in OnMessage I dynamically override the adapter settings like this.  I have a global called ^EDI.Temp("Request Dta",<session ID>,...) that has information gleaned from the message traffic and is used to determine things like where the ultimate destination for the message should go.  There may be a better way but this allowed me to have one basic message flow without having to setup a dozen different output adapters that were all the same except for the settings.  The session ID is unique the each message flowing through the workflow so you can cache information at various stages along the way like the source from the service that received the message, information from the message content as it's being processed by various operations etc.

In my case a message is received from many clients, the internal processing is all the same, and the final destination depends on the client and some information gleaned from the message content.

Lawrence

Method OnMessage(
    pRequest As EnsLib.EDI.X12.Document,
    Output pResponse As EnsLib.EDI.X12.Document) As %Status
{
    #dim tmpObj As EDI.OutputDocument
    Set tmpObj=pRequest
    Set tSessionID=tmpObj.SessionID
    Merge tSettings=^EDI.Temp("Request Data",tSessionID)
    If $Get(tSettings("LineSeparators"))'="" Set ..Separators=tSettings("LineSeparators")
    //Set tOTrace=$Get(^Ens.Degut("TraceCat"))
    //Set ^Ens.Debug("TraceCat")=1
    $$$TRACE("Separators: Generic="_..ShowSep(..Separators)_", Document="_..ShowSep(tmpObj.Document.Separators))
    //Set ^Ens.Debug("TraceCat")=tOTrace
    // Force the Business Operations's separators to match those of the incoming document otherwise
    // the output document seems to use the defaults from the Business Operation instead of any that
    // were explicitly set in the incoming document.
    Set tSep=..Separators
    Set $Extract(tSep,3)=$Extract(tmpObj.Document.Separators,3)
    Set ..Separators=tSep
    Set ..Filename=tSettings("SiteName")_"_Batch_"_$Get(tSettings("BatchID"),"X")_"_%Q.837"
    Set ..Adapter.SiteName=tSettings("SiteName")
    Set ..Adapter.ServerName=tSettings("ServerAddress")
    Set ..Adapter.ServerPort=tSettings("ServerPort")
    Set ..Adapter.UploadPath=tSettings("ServerUploadPath")
    Set ..Adapter.DownloadPath=tSettings("ServerDownloadPath")
    Set ..Adapter.Username=tSettings("Username")
    Set ..Adapter.Password=tSettings("Password")
    Set tFilePath=$Get(tSettings("RootFilePath"))
    If tFilePath="" Set tFilePath=$Get(^Ens.LookupTable("EDIGlobalSettings","RootFilePath"),"C:\EDI")
    Set ..Adapter.FilePath=tFilePath
     :
Reply all
Reply to author
Forward
0 new messages