Thank you, Evgeny, for pointing out how to update user(s) by using CPF Merge. I still like to have an option to configure a group of users in a single file and import this group of users with their passwords into several different IRIS instances which may use different CFP Merge files already. If there is a change to my users, I just update the XML file which gets imported using %ZSTART routine whenever any IRIS instance starts.

The error from Prepare will write to messages.log with this change:

Class otw.dynq

{

ClassMethod prepareQ() As %Status

{

    Set result=##class(%ResultSet).%New("%DynamicQuery:SQL")

    Set sc=result.Prepare("SELECT %ID, Name, Salary FROM Sample.Employee WHERE Salary > ?")

    If $$$ISERR(sc) {

        // here I want to capture the error details in trace , log , that I can see in production web page

        Try {

            Set x = $System.Status.GetOneStatusText(sc)

            Do ##class(%SYS.System).WriteToConsoleLog("otw.dynq prepareQ: "_x)

        } Catch exception {

            Do BACK^%ETN // Log error in error log

        }

    }

    Quit sc

}

}

I created a class for dynamic query:

Class otw.dynq

{

ClassMethod prepareQ() As %Status

{

    Set result=##class(%ResultSet).%New("%DynamicQuery:SQL")

    Set sc=result.Prepare("SELECT %ID, Name, Salary FROM Sample.Employee WHERE Salary > ?")

    If $$$ISERR(sc) {

        // here I want to capture the error details in trace , log , that I can see in production web page

        Try {

            Do ##class(%SYS.System).WriteToConsoleLog("%ZSTART Routine: "_"Import Users",0,0)

        } Catch exception {

            Do BACK^%ETN // Log error in error log

        }

    }

    Quit sc

}

}

I call the Dynamic Query Prepare from BPL and Trace the Status Text from the Prepare:

///

Class otw.bplJSON2HL7 Extends Ens.BusinessProcessBPL

{

/// BPL Definition

XData BPL [ XMLNamespace = "http://www.intersystems.com/bpl" ]

{

<process language='objectscript' request='Ens.Request' response='Ens.Response' height='2000' width='2000' >

<context>

<property name='dynPrepareStatus' type='%Library.Status' instantiate='0' />

</context>

<sequence xend='200' yend='750' >

<trace name='request.Stream.Read()' value='request.Stream.Read()' xpos='200' ypos='250' />

<assign name="dynPrepareStatus" property="context.dynPrepareStatus" value="##class(otw.dynq).prepareQ()" action="set" xpos='200' ypos='350' />

<trace name='dynPrepareStatus' value='$System.Status.GetOneStatusText(context.dynPrepareStatus)' xpos='200' ypos='450' />

<transform name='otw.dtlJSON2HL7' class='otw.dtlJSON2HL7' source='request' target='response' xpos='200' ypos='550' />

<call name='HL7FileOperation' target='HL7FileOperation' async='1' xpos='200' ypos='650' >

<request type='Ens.Request' >

<assign property="callrequest" value="response" action="set" />

</request>

<response type='Ens.Response' />

</call>

</sequence>

</process>

}

Storage Default

{

<Type>%Storage.Persistent</Type>

}

}

The code is in this GitHub repo:

https://github.com/oliverwilms/HL7

Joe,

I created a HL7 production, added JSON Passthrough File Service. Use BPL and DTL to transform Ens.StreamContainer to HL7 Message. Code is here:

https://github.com/oliverwilms/HL7

Input test file I use this (no double double quotes):

{"Doctype":"ADT^A01","PatientId":"123","PatientName":"Alex"}

I see PatientId in HL7 message, but not PatientName. Need to review the DTL ...