Announcement

Collapse

Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

Trouble with code for replacing value in MSH

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble with code for replacing value in MSH

    I hate to admit it, but I surrender. I must be missing something simple in the formatting of this javascript code to change a value in an MSH header. I looked around and found this code from late last year in the forums:
    Code:
    var obr21 = msg['OBR']['OBR.2']['OBR.2.1'].toString(); //assign the obr21 value to a variable
    obr21 = obr21.replace("-0","-2"«»); //perform replacement on variable
    msg['OBR']['OBR.2']['OBR.2.1'] = obr21; //place the new value back into the message
    I tried duplicating that - as it looked like it would work. However, the messages fly right through the channel without the slightest change in MSH3.

    "MY" CODE:
    Code:
    var msh3 = msg['MSH']['MSH.3']['MSH.3.1'].toString();
    msh3=msh3.replace("oldValue","newValue"«»);
    msg['MSH']['MSH.3']['MSH.3.1']=msh3;
    Please tell me what I am missing, I beg of you.

  • #2
    Re:Trouble with code for replacing value in MSH

    Hey, Chris L helped me figure this out (working with a project with the company)

    if (msg['MSH']['MSH.3']['MSH.3.1'].toString() == "oldValue"){
    msg['MSH']['MSH.3']['MSH.3.1'] = "newValue";
    }

    Also, I had the Destination template stating ${message.rawData} and changed that to ${message.encodedData}.

    Comment

    Working...
    X