No announcement yet.

Removing a subcomponent in an incoming message

  • Filter
  • Time
  • Show
Clear All
new posts

  • Removing a subcomponent in an incoming message


    I'm pretty new to Mirth and am having some trouble setting up a channel to cleanup HL7 messages. I'm using the latest

    I'd like to setup Mirth to receive incoming MLLP messages, remove/cleanup some subcomponents and route them through to an MLLP destination. I've found partial documentation in a number of places, but have not been successful in hooking it up together.

    How can I setup this kind of behavior?

    Here's what I've done so far:
    [ul][li]Create a channel with a LLP Listener as source connector[/li][li]Add a transformer to the source with a single Javascript step[/li][li]Add a LLP Sender destination connector, with the default template ${message.encodedData}[/li][/ul]

    It seems that my Javascript is not working, since the message is routed untransformed.
    Is this the correct Javascript for a source transformer:
    delete msg['MSH']['MSH.4']['MSH.4.2'];
    msg['MSH']['MSH.5']['MSH.5.1'] = 'FORINDEX';
    msg['MSH']['MSH.6']['MSH.6.1'] = 'LOCAL';
    Is the msg object the right one? I've also seen message and messageObject being used.

    Should the transformer return the msg object, or is this piece of code enough?

    Any help is appreciated.

  • #2
    Re:Removing a subcomponent in an incoming message

    I tried a simple "File Reader to File Writer" channel on Mirth 1.5 and your sample JS code worked fine.

    Source Tab / Transformer / JavaScript Step:
    delete msg['MSH']['MSH.4']['MSH.4.2'];
    msg['MSH']['MSH.5']['MSH.5.1'] = 'Receiving App';
    msg['MSH']['MSH.6']['MSH.6.1'] = 'Receiving Server';
    Destination Tab / Template was set to
    ${message.encodedData} in the destination template also worked fine.

    Just to troubleshoot the problem, will it be possible for you to try with a "File Reader to File Writer" channel?

    Hope it helps!