Question
· Jan 13, 2021

Handling Errors

I have a case where our EMR is sending data, but not all the values needed for the Ancillary are valued properly and causes that message to error/halt processing on the Ancillary system, not ideal but its what they do. I would expect them to still process the message except that 1 field, but they don't.

I want to add validation to make sure certain fields are valued correctly for the Vendor. 

So I add some statements to take those items that don't pass this validation out to a batch file with headers.

But I want to email out that batch file. How could I have the Email Operation validate that their is a file to send as an Attachment, if that file exists, use it to define who to send it to and what is included in the message?

Is there a sample of this somewhere?

Thanks

Scott

Product version: Ensemble 2018.1
$ZV: Cache for UNIX (IBM AIX for System Power System-64) 2018.1.3 (Build 414U) Mon Oct 28 2019 11:24:02 EDT
Discussion (9)2
Log in or sign up to continue

I think I found a way to handle it but I am struggling on how to send an Ens.Request message to another Operation in the middle of a DTL. I tried this through a function, but Ensemble does not recognize the SendRequestSync that I am trying to send.

Is it possible to send another message to another Business Operation using Code/Function in the middle of a DTL?

A reference to the business process (our message router) that the DTL is being run from is stored in %Ensemble.("%Process") and you can use that to do a SendRequestSync.

Be sure to add lots of error handling. DTLs throwing strange errors can be a pain to troubleshoot.

    if '$D(%Ensemble("%Process")) {
        write "This doesn't work in DTL test mode",!
        quit $$$OK
    } else {
        #dim bp as Ens.BusinessProcess

        set req = ##class(Ens.Request).%New()

        set bp=%Ensemble("%Process")
        set tSC=bp.SendRequestSync("My.Operation",req,.resp)
        
        if $$$ISERR(tSC) {
            // Oops... error!
        }
        
        quit tSC
    }

$this is a reference to the currently executing DTL. We need a reference to the BP that's calling the DTL.

Code action in DTL

 set ^zmm("$this")=$this
 set ^zmm("%Ensemble(""%Process"")")=%Ensemble("%Process")
TESTING>zw ^zmm
^zmm("$this")="Demo.DTL.ChainTest1"
^zmm("%Ensemble(""%Process"")")="7@EnsLib.HL7.MsgRouter.RoutingEngine"