Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

Changing Single Quotes to Double Quotes in an Expression

WayneWooldridge
Alteryx Alumni (Retired)
Created

Suppose you need to change single quotes to double quotes in an expression; i.e. write a formula in an Action, Condition, Filter, Formula, Generate Rows, Multi Field Formula, Multi Row Formula, Charting, Report Map, Table, Message, or Test tool.

To do this, you use the REPLACE function. This is a string function in the format:

REPLACE([FieldName], ‘x’, ‘y’)

where ‘x’ gets replaced by ‘y’ in [FieldName].

Generally, it is not a good idea to mix single quotes with double quotes as this can sometimes produce unexpected results. In other words, avoid using this syntax:

REPLACE([FieldName], ‘x’, “y”)

You might be tempted to write your REPLACE expression like this:

replace.JPG

But this gives you the ‘Malformed Function Call’ error message.

At this point, you may think the double quotes need to be single quotes like this:

replace2.JPG



But, again, you get the ‘Malformed Function Call’ message.

For this expression to work correctly, the expression should be written like this:

replace3.JPG

In other words, the single quote needs to be wrapped by double quotes, and the double quote needs to be wrapped by single quotes!

Comments
tom_montpool
12 - Quasar

An alternate way to do this, without the confusion of which quotation marks to use is to take advantage of a (probably little used) conversion function -- CharFromInt.

 

To replace the single quote, your expression would be:

 

Replace([Field],CharFromInt(39),CharFromInt(34))

 

If you don't know which character numbers to use, run a Generate Rows tool up to 255, and add a formula and run CharFromInt() on the generated rows.

JunePark
8 - Asteroid

Thanks, it helped.