Hi I'm trying to change the code and value in HL7 using Javascript in Mirth Connect. If the incoming msg has Code labeled 'B'
and B = Boy
and I want to change the outgoing message to 'M'
and M = Male
. How would I do that if the HL7 msg segment is in msg['PID']['PID.8']['PID.8.1']
. I wrote down what I think the coding is below. Is it correct or am I missing something?
var PID8 = msg['PID']['PID.8']['PID.8.1']
var B = 'Boy'
var M = 'Male'
if (PID8 === B) {
msg['PID']['PID.8']['PID.8.1']().toString= 'M';
} else if ('M');
msg['PID']['PID.8']['PID.8.1']
? Also, yourelse if
clause is useless, you can remove it. – Serge K.String
or afunction
? You can log it usingconsole.log
andtypeof msg['PID']['PID.8']['PID.8.1']
. – Serge K.