Announcement

Collapse
No announcement yet.

Escapes and new lines.

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

  • Escapes and new lines.

    I'm having issues with some data, and how I deal with it in mirth to get the output I want.

    I receive OBX.5 segments that look like

    Code:
    <OBX.5>Urethral<escape V=".br"/>  Leucocytes           ++<escape V=".br"/>  Lactobacilli-like  ++<escape V=".br"/>  -ve diplococci(Extra)Occ.</OBX.5>
    Now in my transformer when I ask for that OBX segment with

    Code:
    var Ob_Value = msg['OBX']['OBX.5'].toString();
    The value of the string is
    Code:
    <OBX.5>Urethral<escape V=".br"/>  Leucocytes           ++<escape V=".br"/>  Lactobacilli-like  ++<escape V=".br"/>  -ve diplococci(Extra)Occ.</OBX.5>
    How do I deal with the
    Code:
    <escape V=".br"/>
    segments inside the segment I get the value of them instead of the raw text, I would like to get -
    Code:
    Urethral.br  Leucocytes           ++.br  Lactobacilli-like  ++.br  -ve diplococci(Extra)Occ.
    Cheers
    Simon

  • #2
    The whole story on this is the message data comes in a batch file. I then use a channel to split that batch file (it's a strange XML batch beast with the messages inside CDATA tags.
    So when I split the messages up I do a replace on the message string (before)
    Like this.
    prepareString is the message as a string. Channel2 now receives the data in a way that the channel is expecting.

    Code:
    	prepareString = prepareString.replace(/<escape\ V="\.br"\/>/gi, "\\\.br\\");
    	prepareString = prepareString.replace(/<escape\ V="\.in[0-9]{1,3}"\/>/gi, "");
    	var messageString = new XML(prepareString);
    	router.routeMessage('Channel2', messageString);
    Hope this helps someone else

    Cheers

    Comment

    Working...
    X