web stats
Need to replace single quote with double quote in variable on destination - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2010, 03:35 PM
TSmithTRA TSmithTRA is offline
OBX.2 Kenobi
 
Join Date: Nov 2009
Location: Winston-Salem, NC
Posts: 79
TSmithTRA is on a distinguished road
Default Need to replace single quote with double quote in variable on destination

Can anyone assist with figuring out how to put the encoded message in a variable in a javascript writer destination and replace all single quotes with 2 single quotes? I am writing the hl7 message to a SQL database using a stored procedure. the encoded message is being put into a variable that is being passed to the stored procedure with other variables. The ORU sometimes contains a word in the report text that contains a single quote and this breaks the stored procedure. I have tried several options but with no real luck. Any help would be appreciated.

This is what I tried last with no luck.
var RawHL7Data = messageObject.getEncodedData()
RawHL7Data=RawHL7Data.replace(/\047/gi,"''");

This actually works on the transformer.
ReportBody=msg['OBX']['OBX.5']['OBX.5.1'].toString();
ReportBody=ReportBody.replace(/\047/gi,"''");
channelMap.put("ReportBody",ReportBody);
Reply With Quote
  #2  
Old 01-19-2010, 03:45 PM
TSmithTRA TSmithTRA is offline
OBX.2 Kenobi
 
Join Date: Nov 2009
Location: Winston-Salem, NC
Posts: 79
TSmithTRA is on a distinguished road
Default Here is the Solution

var HL7Msg=new String(messageObject.getEncodedData());
var RawHL7Data=HL7Msg.replace(/\047/gi,"''");
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 05:07 AM.


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