How do i escape a single quote in alteryx?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I've created an if-then formula to rename some units. however one of the unit names contains an apostrophe and that is causing an error. How do i get around that?
ELSEIF (Contains('4371-The Women's Place', [CurrentUnitName]))
THEN 'The Women's Place'
Solved! Go to Solution.
- Labels:
- Error Message
- Preparation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
If you have a single quote in the string, then use double quotes around the string. Alternatively, if you have a double quote in the string, use single quotes around the string.
Stephen Ruhl
Principal Customer Support Engineer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What if you have both single and double quotes in a string?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
when you have both types...
You can split your string into
parts with ' bounded by " and
parts with " bounded by '
then concatenate the parts with a +
I just got this example to work
"max(case when Attribute = '"
+ [Name]
+ "' THEN Value_Varchar ELSE NULL END ) AS "
+ '"'+ [Name] + '", '
Results look like
MAX(CASE WHEN Attribute = 'Busines SLA' THEN Value_Varchar ELSE NULL END ) AS "Busines SLA",
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
Does anyone know why the escape character \ would not work for this situation?
For example, why would the following not work? The escape character should tell Alteryx/regex that you are wanting to identify hyphens in a string:
Doesn't work: REGEX_Replace([test], '[ ' ]', 'xxx')...i understand that this should not work
Doesn't work: REGEX_Replace([test], '[ \' ]', 'xxx')...but here I am escaping the hyphen so this hyphen should be interpreted as a hyphen and not the end of the regex expression
**I am aware that REGEX_Replace([test], "[ ' ]", 'xxx')...surrounding the expression in quotes... works fine. But that's not what i want to know. Specifically I want to know why the escape character, which should work, does not in this situation
Thanks
