Question
· May 4

Adding an OBX segment to end of message

We are receiving an ORU message and the vendor is requesting that we append a new OBX segment at the end of the message and I wanted to reach out to see what options might be available. 

So far, I tried the append action in the DTL editor with a single OBX-3 field but it seems to be appending to the field directly instead of creating a new OBX. I've started looking into if whether I could use a function but wanted to first check with the experts on the Discussion here in case there's an easier way to accomplish this. Thank you. 

Product version: IRIS 2022.1
Discussion (2)2
Log in or sign up to continue

Usually, OBX segments are either defined as repeating segments or members of repeating segment groups. The syntax you'll use will vary depending on the HL7 Document Category and Structure you're using in your DTL. In HL7 2.5.1, the OBX segment itself is non-repeating, but is part of a repeating group (OBXgrp) inside another repeating group (ORCgrp) inside yet another repeating group (PIDgrpgrp).

You first need to get the count of the total number of OBX segments, which you can do by supplying the "*" character in the iteration argument to the source path's OBXgrp(). Add 1 to that, and you have your iteration for the new OBX segment.

Use that value as the iteration for the new OBX segment and populate the fields as needed, as in the example below:

The above assumes that the OBX segments are the last segments in the message. If they're not and the message requires another OBX at the very end, it's a bit more complicated ... you'd create a new segment object, populate it, then use the AppendSegment method to slap it on the end of the target: