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

Reset 'count' every time the channel starts.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Reset 'count' every time the channel starts.


    I've created a channel at Mirth 1.7 that uses a database connection at source and a file writer at destination, creating a Worklist DICOM file per message.

    This channel starts by time polling, running once every day.

    The SQL at the source sections retrieves a lot of records that become the same amount of messages.

    I need to put a counter in the destination files name that began from "1" and ends at number of messages by every time the channel starts.

    I can do something like this with "Count" variable in Destination Mappings, but i don't know how to reset this counter to "1" by the next time the channel starts.

    Please, could you give me some advice?

    I wonder if the pre/post processor scripts could be useful for that, but I don't know exactly how they work.


    Carles Massallé

  • #2
    Re:Reset 'count' every time the channel starts.

    If you set up your source connector to use JS, you can define a new variable called i.e counter, with a value of 0 and then push it to the channel map.

    Then, in your file writer destination, you can define a JS transformer that gets this variable from the channel map, add +1 to its value and then push it again to the channel map.

    Finally in your file writer destination you'll get a new variable called
    "counter" that will be reseted every time the channel executes the reading (one time every day), and it's increased by 1 for any message that processses.

    If you don't get the "counter" var increased for every message, you can try to do the inc in the postprocessor step.

    Hope that helps!