1.2k questions

1.4k answers

361 comments

339 users

Categories

Sidebar
0 votes
391 views
by adam-d-5091 (370 points)
Forgive the noobie question but this has me stumped at this point. I simply would like to remove the contents of a field and replace if sometihng is there or add something to the field if it is blank. Below is my sample message:

 

MSH|^~\&|Paxera|Physicians East|Insight Medical|Physicians East|20200427145126||ORU^R01^ORU_R01|20200427145126|P|2.3.1|||NE||||eng^English^ISO639|||

I would like to make MSH-9 to always be ORU^R01

I currently have:

if (source.getNode("MSH-9") == "ORU^R01^ORU_R01") {
   message.setNode("MSH-9", "ORU^R01");
}

 

I know my issue here is it is always looking for ORU^R01^ORU_R01 hence why it isnt working every time.

 

Anyway, thanks in advance!

1 Answer

+1 vote
 
Best answer

Remove the if statement:

change:

if (source.getNode("MSH-9") == "ORU^R01^ORU_R01") {
   message.setNode("MSH-9", "ORU^R01");
}

to

message.setNode("MSH-9", "ORU^R01");

by michael-h-5027 (14.8k points)
selected by adam-d-5091
...