Hello all. Again, I am still very new to Alteryx Designer. I do have a use case where for a given column, I need to replace all instances where the value starts with "F" and replace with this text: "Taking everything into account, what can we do better?".
Example: F32 is replaced with "Taking everything into account, what can we do better?"
Please see screenshot. I know it's a basic question. But, I cannot seem to get the syntax right. I am assuming we also need the Startswith function.
Mike
Solved! Go to Solution.
Hi @mshinn9999 - try this: if StartsWith([Interview Question], "F") then Replace([Interview Question], [Interview Question], "Taking everything into account, what can we do better?") else [Interview Question] endif
Hello @mshinn9999 you can also achieve this by using a regex tool (one of my favorite)
I've attached an image with the configuration but you just add the pattern and the replacement text.
In my opinion it's more explicit and easier to maintain.
Have a fantastic day!
Amazing! I love this community! Thank you for quick turn-around.
Similar to @Bren_Spill 's solution, this expression in Formula Tool would also work:
Interview Question =
IF StartsWith([Interview Question], "F")
THEN "Taking everything into account, what can we do better?"
ELSE [Interview Question]
ENDIF
if StartsWith([Interview Question], "F")
then Replace([Interview Question], [Interview Question], "Taking everything into account, what can we do better?")
else [Interview Question]
endif
You could use REGEX_REPLACE("F\d\d", "Taking everything into account, what can we do better?")
Thank you all for the quick responses. I have this as future reference. :)