web stats
Mirth Community - View Single Post - Example Lab Report
View Single Post
  #7  
Old 08-06-2019, 12:23 PM
ASIFM786 ASIFM786 is offline
Mirth Newb
 
Join Date: Oct 2008
Posts: 17
ASIFM786
Default confused

I have added and used this script: -
var results5 = new XML('<tbody></tbody>');
var tr;

const red_flag = <img src="/mirth/graphics/flag_red.png"/>;

for each (var obr in msg.OBR) {
var group = <group>{obr}</group>;
getSegmentsAfter(msg, obr, /OBX|NTE/, true).forEach(function(seg) {group.appendChild(seg)});
var obx8 = group['OBX']['OBX.8']['OBX.8.1'].toString();
var tr = <tr>
<td>{obx8 != 'N' ? red_flag : ''}</td>
<td>{group.OBX['OBX.3']['OBX.3.2'].toString()}</td>
<td>{group.OBX['OBX.5']['OBX.5.1'].toString() + " "+ group.OBX['OBX.6']['OBX.6.1'].toString()}</td>
<td>{obx8}</td>
<td>{group.OBX['OBX.7']['OBX.7.1'].toString() + " " + group.OBX['OBX.6']['OBX.6.1'].toString()}</td>
<td>{group.OBR['OBR.2']['OBR.2.1'].toString()}</td>
<td>{divWrap(group.NTE['NTE.2']['NTE.2.1'])}</td>
</tr>;
tmp.appendChild(tr);
}

// takes an XMLList and returns a new list of the string value of each list item
// wrapped in div tags
function divWrap(list) {
var ret = <></>;
for each (var e in list) {
ret += <div>{e.toString()}</div>
}
return ret;
}
channelMap.put("Results5",results5);

but it does not do anything just returns an blank, is there something i have missed?
Reply With Quote