Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Error: Action (12): Parse Error at char(0): Unknown function "IF"

harmeettsiinghsaini
6 - Meteoroid

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"

 

 

 

11 REPLIES 11
apathetichell
18 - Pollux

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]...

atcodedog05
22 - Nova
22 - Nova

Hi @harmeettsiinghsaini 

 

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:

atcodedog05_0-1621434076251.png

 

Output:

atcodedog05_1-1621434168667.png

 

Hope this helps 🙂

atcodedog05
22 - Nova
22 - Nova

Hi @harmeettsiinghsaini 

 

We can make it more sophisticated by changing the formula to below which is directly replace year with string in [#1]

atcodedog05_0-1621434625601.png

 

Hope this helps 🙂

apathetichell
18 - Pollux

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.

harmeettsiinghsaini
6 - Meteoroid

Hi,

 

Tried using Drop down list but again it shows the same error. 

harmeettsiinghsaini_0-1621435406020.png

 

 

apathetichell
18 - Pollux

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.

harmeettsiinghsaini
6 - Meteoroid

Wow!

 

That worked! Thank you every single person in this post! I learnt something new from all of you!

 

Cheers!

 

 

atcodedog05
22 - Nova
22 - Nova

Hi @harmeettsiinghsaini 

 

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.

harmeettsiinghsaini
6 - Meteoroid

The problems is still not fixed.

 

Even if I select Days, it continues to show output in years

 

Labels