Trying to replace text but getting an error.

  • 32Views
  • Last Post 27 August 2019
  • Topic Is Solved
Thomas Azar posted this 23 August 2019

Trying to manipulate datae grabbed from salesforce and insert it in the correct formatting into a MySQL database. I am getting an error thrown while trying this. 


"["+REPLACE(Area_of_Practice_National_Attorneys__c, ";", ",")+"]"


I am also needing to add double quotes inside the strings of text and replace, but this will throw an error as double quotes already declare a string in your platform. 

The function "REPLACE" does not support the data type "DT_NTEXT" for parameter number 1. The type of the parameter could not be implicitly cast into a compatible type for the function. To perform this operation, the operand needs to be explicitly cast with a cast operator.

Dmitriy Muzurov posted this 27 August 2019

Hi Thomas,

Thank you for submitting a ticket with us.

You can use this expression:

"\"" + "[" + REPLACE((DT_WSTR,50)Area_of_Practice_National_Attorneys__c, ";", ",") + "]" + "\""

It will replace this value - example;

with this one - "[example,]"

If you don't need square brackets, the part "[" + can be removed from start and end of the expression.

Should you have any questions, do not hesitate to contact us back.