I am trying to build a standard macro. Here I have an input file which has Player name and its Date of birth. I am trying to add a column called Age.
I created an interface with three radio button options.
- Age By Years
- Age by Months
- Age by Days
the action interface is configure as update the formula as
if (#1) then replace([Destination],"years","days") elseif
(#2) then replace([Destination],"years","months") else
[Destination] endif
However I get the error as
Error: Action (12): Parse Error at char(0): Unknown function "IF"
Solved! Go to Solution.
I think I encountered this once before as some temporary error - so assuming you have your action tool configured probably (update value with formula) - try it again this time using the formula build interface and selecting the IF function after expanding... I think technically in the Alteryx engine it's IF THEN ELSE ENDIF and while it usually is fine with lower case sometimes it has minor hiccups..
also I believe it will want #1,#2,#3 called as [#1],[#2],[#3]...
Radio button might not be the best option for your scenario. I would suggest use of drop down tool. And to use the connections input directly you can connect directly to Q anchor. Refer below [#1] is directly input from connection and is compared with days,months.
Workflow:
Output:
Hope this helps 🙂
We can make it more sophisticated by changing the formula to below which is directly replace year with string in [#1]
Hope this helps 🙂
I'd also suggest looking at this weekly challenge: https://community.alteryx.com/t5/Weekly-Challenge/Challenge-225-How-Long-Has-It-Been/m-p/606415/high...
It worked with selections and computations of date/time. I used detours with check boxes. It isn't that your strategy won't work but there is more room for error with it.
Hi,
Tried using Drop down list but again it shows the same error.
hmmmm - this is probably easier using standard workflow tools instead of making all of your conditional logic and value swapping in update tools. it's easier to troubleshoot there.
Wow!
That worked! Thank you every single person in this post! I learnt something new from all of you!
Cheers!
Happy to help 🙂.
PS:You are allowed to mark multiple posts as solution if it helped you. This will help others also to find answers.