User bio
404 bio not found
Member since Nov 11, 2020
Replies:

It's slightly dependant on the HL7 Version and Message Type, but assuming you're working with ORM_O01 messages using HL7 V2.3, you have a few options:

Example 1, Multiple Ifs, one for each variation (I only did 2 in the screenshot to save time) :

Example 2, If/Else where we assume that we only want "I" in OBR:18 when PV1:2 is "I", and otherwise set to "O": 

Example 3, use the $CASE function:

All of these can be combined with the response you just got here HL7 DTL formatting | InterSystems Developer Community | Business Process for the same question, assuming you want to put them into a subtransform, but I'd start with what I have shared here first, and venture into subtransforms and auxiliary-based configs after you get this nailed down. 

To give an example of where I have done something similar:

I have a Service that will check if the active mirror has changed since the last poll, and will trigger a message to the "Ens.Alert" component in the production if it has changed.

To do this, I have a service with the following code:

Class Demo.Monitoring.SystemMonitor Extends Ens.BusinessService
{

Method OnProcessInput(pInput As %RegisteredObject, Output pOutput As %RegisteredObject, ByRef pHint As %String) As %Status
{
	Set tsc = ..CheckMirroring()
	Quit tsc
}

Method CheckMirroring() As %Status
{
	Set triggered = 0

	//Get the current server
	Set CurrServer = $PIECE($SYSTEM,":")

	/**Check Global exists, and create it if it does not.(Should really only ever happen once on deployment, but this is a failsafe)**/
	Set GBLCHK = $DATA(^$GLOBAL("^zMirrorName"))
	If GBLCHK = 0{
		Set ^zMirrorName = CurrServer
		Quit $$$OK //No need to evaluate on first run
	}

	If ^zMirrorName = CurrServer {
		/*Do not Alert*/
		Quit $$$OK
	}
	Else {
		/*Alert*/
		Set AlertMessage = "The currently active server has changed since the last check, suggesting a mirror fail over."
		Set AlertMessage = AlertMessage_" The previous server was "_^zMirrorName_" and the current server is "_CurrServer_"."
		Set ^zMirrorName = CurrServer
			
		Set req=##class(Ens.AlertRequest).%New()
		Set req.SourceConfigName = "System Monitor"
		Set req.AlertText = AlertMessage
		Set req.AlertTime = $ZDATETIME($HOROLOG,3)_".000"
		
		Set tSC = ..SendRequestSync("Ens.Alert", req)
		Quit tSC
	}
}

}

Then, from within my production, I then have the service that is using this class configured with "CallInterval" set to the desired frequency of running:

Certifications & Credly badges:
Julian has no Certifications & Credly badges yet.
Global Masters badges:
Followers:
Following: