Announcement

Collapse
No announcement yet.

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