Announcement

Collapse

NextGen (Mirth) Connect 3.10.0 Released!

NextGen (Mirth) Connect 3.10.0 is now available as an appliance update and on our GitHub page. This release includes better SQL Server database support, security improvements through fixes and library updates, and improvements for the Advanced Clustering plugin with a focus on improving performance of many of the tasks that are carried out on a frequent interval. 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

Preprocess Script

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

  • Preprocess Script

    I have a channel that will receive different set of messages. It will receive
    ADT - A01, A04, A18
    ORM
    ORU
    ZPD

    My issue is that the MSH segment under MSH.9 it only has MSH.9.1 it doesn?t contain the message type. I have performed a replace for the ORM, ORU and ZPD message and it works fine. I tried doing the same thing with the ADT segment by creating an IF Statement, but now the channel doesn?t want to deploy.

    The following is what I have done in the preprocessing script with the ADT events, but it doesn?t work.

    If message.IndexOf("EVN|A04"){
    message = message.replace("|ADT|","|ADT^A04|");
    }
    If message.IndexOf("EVN|A08"){
    message = message.replace("|ADT|","|ADT^A08|");
    }
    If message.IndexOf("EVN|A18"){
    message = message.replace("|ADT|","|ADT^A18|");
    }
    message = message.replace("|ORM|","|ORM^O01|");
    message = message.replace("|ORU|","|ORU^R01|");
    message = message.replace("|ZPD|","|ZPD^ZPD|");

    return message;

    Like I mentioned before, the ORM, ORU and ZPD replace work fine, but once I add the ADT with the If statement it doesn?t work.

    Could someone tell me what I?m doing wrong?

    Thanks

    Kelvin

  • #2
    Re:Preprocess Script

    Looks like a syntax problem.

    Check if this sample works for you...

    Code:
    if (message.IndexOf('EVN|A04')){ 
       message = message.replace('|ADT|','|ADT^A04|');
    }
    Hope it helps!

    Comment


    • #3
      Re:Preprocess Script

      Thanks, it seems that I had my IF with a capital "I" and JS didn't like it. The channel deployed.

      Comment

      Working...
      X