Search code examples
hl7mirth

Move the files to a location only if filter condition satisfies in mirth


I am new to mirth and I want the "After processing Action" in source to perform only if the rule in the source filter satisfies for a channel.


Solution

  • You can do this by applying a filter in Destination channel.

    1. Select destination connector on which you need to apply filter.
    2. From left side Select Edit filter from channel task.
    3. Add one new rule rule and select JavaScript as type.

    Add JavaScript code as below.

    For example you want to filter all message other than ADT then add a condition as below.

    if(msg['MSH']['MSH.9']['MSH.9.1'].toString() != "ADT")
    {
       return false;
    }
    

    So this code will send only ADT message to Destination and all other messages are filtered.