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
Client | Filing date 1 (yyyy-mm-dd) | Flag |
Client A | 2021-12-06 | Yes |
Client B | 2021-12-05 | No |
Solved! Go to Solution.
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
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.
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...
Hi @JamesBarzda
You'll want to modify your formula to be:
IF [Filing date 1]=DateTimeToday()
THEN "Yes"
ELSE "No"
Endif
That's working perfectly, thanks both! Much appreciated