I have a message structure where I need to loop through multiple PID.3 segments, selecting one with a PID.3.5 == 'MR' and then replacing PID.3.4 with identifier. I understand how to loop through multiple segments such as OBX, but not sub-segments. I have some sample code (not correct) as a start. Any guidance appreciated.
var pid = msg.PID;
for each (pid3 in pid[PID.3]) {
if (pid3[PID.3.5] == 'MR') {
pid3[PID.3.4] = 'IDENTIFIER';
};
};
This seems to work