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

replacing last character in message

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

  • replacing last character in message

    Hi all,

    I have a legacy system that requires the end-of-segment characters to be line feeds Hex 0A. For the most part I've pieced together enough from the forums to be able to handle the issue except for one last piece. Our data is typically HL7 v2.2 or 2.3.

    I have unchecked the "Convert LF to CR" option on both source and destination transfomers' templates. Also, in my preprocessor I have this statement
    Code:
    return message.replace(/\r/g, "\n"«»);
    This effectively replaces all of the carriage returns with new lines, but it leaves one carriage return on the last line without a following new line. This typically doesn't cause a problem, but I left the "append messages" option on without making a unique filename. This caused the next MSH segment to run up to the previous segments line.

    Is there any way (preferably javascript) to delete that character and append a new line?

    Can I modify the message with the postprocessor?


    Thanks,
    Daniel

  • #2
    Re:replacing last character in message

    To achieve it, I suggest the use of a JavaScript Step at destination:

    Code:
    var mes=''+messageObject.getRawData();
    channelMap.put('newOutput',mes.replace(/r/g, "n"«»));
    Then, at the LLP Sender template, change the default template for the variable ${newOutput}

    Comment

    Working...
    X