Hi ,
I'm attempting to convert one OBX segment that has a value in the OBX.3.1 field to be NTE Segment . I'm attempting to do this in the Preprocessor Script. I'm very close to getting this to work just need a second pair of eyes to see the mistake in my code. Below is the logic I have in the Preprocesor script. I cannot seem to get the proper logic for the for loop.
"for each (msg in msg.OBX) is causing me to get an error that says "Cannot Read property OBX.3.1 from undefined.
var mymsg = new XML(SerializerFactory.getHL7Serializer().toXML(mes sage));
//var number_of_OBX = mymsg.OBX.length();
var obx;
var msg;
// for each (msg in msg.OBX) {
logger.info('The value of OBX-3.1 is ' );
logger.info(mymsg['OBX'][0]['OBX.3']['OBX.3.1'].toString());
if (mymsg['OBX.3']['OBX.3.1'].toString() == 'ILDATE') {
message = message.replace(/\rOBX/g, "\rNTE")
}
// }
My logger info show the first OBX.3.1 valued to "AMIK" which is correct in the test HL7 Lab message. The last OBX of 6 OBX segments has the value of "ILDATE" this will vary by each Lab Messages sent.
Attached is my channel.
I'm attempting to convert one OBX segment that has a value in the OBX.3.1 field to be NTE Segment . I'm attempting to do this in the Preprocessor Script. I'm very close to getting this to work just need a second pair of eyes to see the mistake in my code. Below is the logic I have in the Preprocesor script. I cannot seem to get the proper logic for the for loop.
"for each (msg in msg.OBX) is causing me to get an error that says "Cannot Read property OBX.3.1 from undefined.
var mymsg = new XML(SerializerFactory.getHL7Serializer().toXML(mes sage));
//var number_of_OBX = mymsg.OBX.length();
var obx;
var msg;
// for each (msg in msg.OBX) {
logger.info('The value of OBX-3.1 is ' );
logger.info(mymsg['OBX'][0]['OBX.3']['OBX.3.1'].toString());
if (mymsg['OBX.3']['OBX.3.1'].toString() == 'ILDATE') {
message = message.replace(/\rOBX/g, "\rNTE")
}
// }
My logger info show the first OBX.3.1 valued to "AMIK" which is correct in the test HL7 Lab message. The last OBX of 6 OBX segments has the value of "ILDATE" this will vary by each Lab Messages sent.
Attached is my channel.
Comment