I have HL7 ORU messages that I need to modify. I want to insert OBX segments before the OBX segments that already exist in the message. These new OBX segments will form a header to the order report that is getting stuffed into the billing system.
My first stab at this copies over the MSH, PID, PV1 and OBR segments and adds some OBX segments. I then iterate over the existing OBX groups. I was trying to increment the value of %g1 in the pre-xlate tcl to move the OBX from group %g1 to group %g1 + 18.
set d [xpmfetch $xlateId {$%g1}]
set ctr [datget $d VALUE]
set ctr [expr $ctr + 18]
xpmstore $xlateId {$%g1} d -c $ctr
datdestroy $d
This does not increment the value of %g1 like I thought it would. Do you have any suggestions on how to insert OBX groups /before/ the existing OBX groups?
Thanks for your help.
–dennis