web stats
Escapes and new lines. - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2010, 05:23 PM
simidau simidau is offline
OBX.2 Kenobi
 
Join Date: Feb 2008
Posts: 62
simidau
Default 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
Reply With Quote
  #2  
Old 02-08-2010, 11:12 PM
simidau simidau is offline
OBX.2 Kenobi
 
Join Date: Feb 2008
Posts: 62
simidau
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 09:47 PM.


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