Alteryx Designer Desktop Discussions

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

Todays date formula question

JamesBarzda
7 - Meteor

I'm building a workflow, to be ran daily, with a formula tool to review a date column and set a new column value to 'Yes' if the date column match's todays date and 'No' if it doesn't (See below table). I've tried using the below formula but receive the following error : Invalid type in operator==.

 

Any advice? Is it an issue with the date format? 

 

IF [Filing date 1]=DateTimeToday()
THEN [Flag] = "Yes"
ELSE [Flag] = "No"
Endif

 

ClientFiling date 1 (yyyy-mm-dd)Flag
Client A2021-12-06Yes
Client B2021-12-05No
6 REPLIES 6
TheOC
15 - Aurora
15 - Aurora

Hey @JamesBarzda 

To make that comparison, you will need to ensure your date is a date format.

There are many ways to do this - the easiest being the datetimetool:
https://help.alteryx.com/20213/designer/datetime-tool

You could also use the 'toDate' formula, to convert it within the formula:
https://help.alteryx.com/20213/designer/datetime-functions

Cheers,
TheOC


Bulien
Luke_C
17 - Castor

Hi @JamesBarzda 

 

To add on to @TheOC 's answer, since your Filing date appears to be in the correct format, you could change the datatype to 'date' in a select tool early in the workflow so it's treated correctly as a date. 

JamesBarzda
7 - Meteor

Thanks both 👍 I've used the Select tool to convert from Date to DateTime data type which the 'DateTimeToday' seems to like (no errors) but it's populating the Flag column with '0' rather than the Yes or No specified in the formula. I've tried as a Boolean and vstring with the same result...

TheOC
15 - Aurora
15 - Aurora

Ensure within your formula you are outputting to a string field with a length more than 3

Hopefully this helps,
TheOC


Bulien
Luke_C
17 - Castor

Hi @JamesBarzda 

 

You'll want to modify your formula to be: 

IF [Filing date 1]=DateTimeToday()
THEN  "Yes"
ELSE "No"
Endif

JamesBarzda
7 - Meteor

That's working perfectly, thanks both! Much appreciated

Labels