Sidebar

Transform the values in all instances of OBR-16.1 in an HL7 ORM message

0 votes
345 views
asked Apr 23, 2021 by michael-f-4439 (120 points)
retagged Apr 23, 2021 by michael-f-4439

I am trying to use a table lookup to transfom the values contained in OBR-16.1. The source and message are both HL7 ORM messages.

The code I have so far is:


var value = source.getNode("OBR-16.1");
value = qie.doTableLookup(value, value, 'Centricity Username To NPI Crossreference', 'Username', 'NPI Number');
message.setNode("OBR-16.1", value);


The lookup table is a simple two column crossreference set up as a sytem variable. The not found action is set to 'use source value'.

It works great on the first instance of OBR-16.1, but any subsequent instances are not transformed. No error is generated, with the original values remaining.

commented Apr 23, 2021 by michael-f-4439 (120 points)
It works perfectly. And I am now one point farther along in learning QIE.

Thanks, Brandon. Hugely appreciated.

1 Answer

+1 vote

You will need to loop through each record. The code in the question only looks at the first value:

for (var i = 1; i <= message.getCount('OBR'); i++) {
   var value = source.getNode("OBR-16.1", i);
   value = qie.doTableLookup(value, value, 'Centricity Username To NPI Crossreference', 'Username', 'NPI Number');
   message.setNode("OBR-16.1", value, i);
}

answered Apr 23, 2021 by brandon-w-8204 (33,270 points)
...