Daniel Lee · Jul 28, 2022

How to obtain object value in DTL Trace Event

I have an existing DTL and I need to insert a trace statement so that it writes the value of the target object. However, I haven't been successful in completing this. 

I have opened the DTL viewer in Studio, and have inserted a trace statement. 

  • If I insert just plain text, the trace statement works, e.g., Value="Hello World"
  • If I insert the target variable, it does not work, e.g., target.Patient.Allergies.(k1).AllergyID. For this value, compile fails with an InvalidName error ERROR #1011: Invalid name : '##class(Ens.Util.Trace).WriteTrace("user","PHI.DTL.SDAtoACX","Transform",target.Patient.Allergies.(k1).AllergyID)'
  • If I use curly braces, e.g., target.{Patient.Allergies.(k1).AllergyID}, I can compile without errors. 
  • The intermediate file shows the following: Do ##class(Ens.Util.Trace).WriteTrace("user","PHI.DTL.SDAtoACX","Transform",target.GetValueAt("Patient.Allergies.("_(k1)_").AllergyID"))
  • When I send a document to the server, the process fails.

So, what is the proper syntax to see the value of the AllergyID during the DTL process?

Product version: Ensemble 2013.1
0 218
Discussion (1)1
Log in or sign up to continue

Hey Daniel.

As a starting point, I would not be adding the trace when viewing the DTL in Studio, and instead I would add it when using the Data Transformation Builder:

Which gives me:

If this is not working for you, make sure that the router has "Log Trace Events" enabled in the router settings and the router has been restarted since enabling the trace. I have been caught out numerous times enabling the trace and then forgetting to restart the process/router in the production.