Announcement

Collapse
No announcement yet.

Need to replace single quote with double quote in variable on destination

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

  • 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);
    Tom Smith
    IT Director
    Triad Radiology Associates

  • #2
    Here is the Solution

    var HL7Msg=new String(messageObject.getEncodedData());
    var RawHL7Data=HL7Msg.replace(/\047/gi,"''");
    Tom Smith
    IT Director
    Triad Radiology Associates

    Comment

    Working...
    X