Jonathan Anglin · Jul 7, 2020

DTL vs. ObjectScript

As I've become a little more familiar with HealthShare, I'd like to start exploring different ways of doing things. To date, the bulk of my data transformations have been using DTL; only using ObjectScript for a few operations that write to external SQL tables that were largely based on examples provided by my sales engineer.

I'd like to trying doing all of the data transformation in a process using ObjectScript. This would be a much closer approach to my experience doing transforms using JavaScript in our other interface engine, and I think using this as a method to better learn the idiosynchronies of ObjectScript will serve me well.

To use "DTL-speak", I know how to get a value in the "source" inbound message, but not how to set a value in the "target" outbound message. In the simple example below, I'm grabbing the patient mrn from the inbound and looking to prefix it in the outbound message (a typical change). How is this accomplished?

Class TestClassName Extends Ens.BusinessProcess [ Language = objectscript ]
Method OnMessage(msgIn As EnsLib.HL7.Message, Output msgOut As EnsLib.HL7.Message) As %Status
set tSC = $$$OK
set patientMRN = msgIn.GetValueAt("PID:3.1")

//how do set this going out? Like this?
set msgOut.GetValueAt("PID:3.1") = "PRE"_patientMRN

1 0 4 155
Log in or sign up to continue

Thank you, Robert, that is exactly what I was looking for!

To know how a particular DTL action translates into ObjectScript:

  1. Open DTL class in Studio
  2. Press Ctrl+Shift+V OR See Other Code Button
  3. Check Transform method - it contains ObjectScript implementation for the DTL

Thank you, Eduard! This is really interesting. It looks quite a bit more verbose.