Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Escapes and new lines. (http://www.mirthcorp.com/community/forums/showthread.php?t=3517)

simidau 02-08-2010 04:23 PM

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

simidau 02-08-2010 10:12 PM

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


All times are GMT -8. The time now is 07:48 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation