最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using a Mirth Transformer to loop through multiple PID.3 Segments - Stack Overflow

programmeradmin4浏览0评论

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';
    };
};

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';
    };
};
Share Improve this question edited Jun 25, 2015 at 4:47 skyman asked Jun 25, 2015 at 4:38 skymanskyman 2,3454 gold badges32 silver badges61 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

This seems to work

for each (pid3 in msg['PID']['PID.3']) {
    if (pid3['PID.3.5'].toString() == 'MR') {
        pid3['PID.3.4'] = 'IDENTIFIER';
    }
}
发布评论

评论列表(0)

  1. 暂无评论