Hello,
I noticed that the obrSegmentPositionIndex_orc variable is incremented inside the OBX loop, whereas it should be incremented within the OBR loop.
As a result, the parent ORC segment for each OBR is incorrectly assigned. For example, if I have a message structure like MSH PID ORC OBR OBX ORC OBR OBX, the parent of every OBR segment is always considered to be the first ORC, even if multiple ORC segments are present.
The fix is straightforward: the increment should be moved one level down, into the OBR loop.
Thanks