AdamReed_1

escaping apostrophe in variable

Discussion created by AdamReed_1 on Jul 13, 2017
Latest reply on Jul 14, 2017 by AdamReed_1

Hello,

 

I have a script which saves records as a number of pdfs to folders which match the filenames of the pdfs. The filenames are determined by a text field (variable $name, for example).  For example, the record in which the name field is "Smith" will save as a pdf named "Smith.pdf" to a folder called "Smith."  That is no problem.  When text of the name field contains a special character such as an apostrophe, however, such as "O'Brien" I get an error as I haven't escaped the apostrophe correctly.  I've tried to research this, and thus far I have tried:

 

Set Variable ($name; Value: (person::name)

Set Variable ($name; Value:GetAsText (person::name)

Set Variable ($name; Value:Substitute (person::name ; "'" ; "\'")

Set Variable ($name; Value:Substitute (person::name ; Char(39) ; Char(92) & Char(39) )

 

However none of these seem to do the trick.

 

Any thoughts?

 

Thanks,

Adam

Outcomes