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.
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.
What if you have both single and double quotes in a string?
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",
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