Hello,
I am attempting to pick up a message, separate our the ORC segments, and use that data to query our database and insert the appropriate information into a couple of fields (orcGroup.setNode("OBR-5", priority);). Below is what I have put together, but for some odd reason I can't get any information to write to the fields. I know I must be doing something wrong that is likely very simple, but after numerous tries and searching here for an answer I have ran into a wall.
If anyone can assist with this it would be greatly appreciated!
var orcGroups = message.getAllNodes('ORC[group=!ORC]');
for (var i = 0; i < orcGroups.length; i++) {
qie.debug('i: ' + i);
var orcGroup = qie.parseHL7String(orcGroups[i]);
var ordernum = '\'' + orcGroup.getNode("OBR-2") + '\'';
var signusridquery = 'select TOP 1 USRID from ORDERS where ordernum =' + ordernum;
var signusrid = qie.doSelectQuery('Test-DB', signusridquery, true);
var priorityquery = 'select TOP 1 PRIORITY from ORDERS where ordernum =' + ordernum;
var priority = qie.doSelectQuery('Test-DB', priorityquery, true);
orcGroup.setNode("OBR-5", priority);
orcGroup.setNode("OBR-27", signusrid);
}
}
Thanks,
Jonathan