Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Action tool with DateTimeFormat

Joker_Hazard
11 - Bolide

Hey guys.

I'm trying to use action tool to format the date to check whether it's Monday and Tuesday or other dates. However its not working.

Joker_Hazard_0-1657216513318.png

 

Formula in action tool: IF (DateTimeFormat([#1],"%A") = 'Monday' or 'Tuesday') THEN '4' ELSE '2' ENDIF

Input text:

Joker_Hazard_1-1657216573330.png

 




Action tool: 

Joker_Hazard_2-1657216594920.png

 

Anyone knows whats going on?

Thanks

3 REPLIES 3
gabrielvilella
14 - Magnetar

You need to separate the OR into two parts.

 

IF DateTimeFormat([#1],"%A") = 'Monday' OR DateTimeFormat([#1],"%A")='Tuesday' THEN '4' ELSE '2' ENDIF

 

 

I believe you can use the IN as well.

 

IF DateTimeFormat([#1],"%A") IN ('Monday','Tuesday') THEN '4' ELSE '2' ENDIF​

 

 

Joker_Hazard
11 - Bolide

@gabrielvilella Thanks for the quick response!

I changed it, however I don't know how to say to the filter tool that it should change "test" column. How does it work? I am filtering today's date and its coming the number "4" when it should be "2".

gabrielvilella
14 - Magnetar

I just noticed your field Test is numeric. You need to adjust the formula to have a numerical output by removing the quotes. Also, I can see that you have Test on the text input and Teste on the filter, they are not the same, you should adjust that.

IF DateTimeFormat([#1],"%A") IN ('Monday','Tuesday') THEN 4 ELSE 2 ENDIF
Labels
Top Solution Authors