Question
· Dec 13, 2016

How to reference a specific field in a DTL

I want to set the value in the second field of OBX-5, or OBX-5-2. My schema is not broken down to that granular level, so I can't just click OBX-5-2 to populate it. I tried a few variations without success.

target.{PIDgrpgrp().ORCgrp().OBXgrp(1).OBX:ObservationValue(1).2}

target.{PIDgrpgrp().ORCgrp().OBXgrp(1).OBX:ObservationValue(1)(2)}

target.{PIDgrpgrp().ORCgrp().OBXgrp(1).OBX:ObservationValue(1.2)}

 

Any ideas?

Discussion (4)0
Log in or sign up to continue

In general, you should not leave any parentheses in the segment portion of a VDoc path empty.  If your DTL references target.{PIDgrpgrp().ORCgrp().OBXgrp(1).OBX:5.2}, how will the DTL know which PIDgrpgrp or which ORCgrp you're trying to reference?

If you can guarantee your messages will only have one PIDgrpgrp and one ORCgrp within that, then you can just use 1's, like this: target.{PIDgrpgrp(1).ORCgrp(1).OBXgrp(1).OBX:5.2}

If it's possible your messages will have multiple PIDgrpgrps or ORCgrps, then you may need nested foreach loops to reach all of them.  Even in the foreach loop, only the last set of parentheses in the segment path should be empty.

On top of that, for the field portion of the VDoc path, using a numeric reference will always work, even if the segment structure of the message doesn't match the schema.

In order to see how to reference the field by name rather than numeric, the best tool to use is the Interoperate message viewer.  This can be found in the management portal at Ensemble->Interoperate->HL7 v2.x->HL7 Message Viewer.

If you save your message as a file and open it using this message viewer, and set the DocType correctly, then you will see the message on the right side with all segment identifiers and fields highlighted in blue.  You can mouse over any segment identifier to see the exact segment path needed to reach that segment, and then you can mouse over any field to see the name that should be used to reference that field.

Here are some examples.  First is the settings I used to open the message, followed by the tooltip when I mouse over the OBX segment, followed by the tooltip when I mouse over the '39' field.