Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Today,s date in formula

jeetamar11
7 - Meteor

I am struggling with usage of datetimetoday() function in formula. I have a column name 'case create'- i need to replace all the dates with today's date and blanks with a string " No case" in that column. I keep getting error that says Unmatched or parse.

please help!

7 REPLIES 7
ed_hayter
12 - Quasar

you could wrap your datetimnetoday() in tostring

 

if isempty([date]) then "no case" else tostring(datetimetoday()) ENDIF

JamesCharnley
13 - Pulsar

Hi @jeetamar11 

 

If you want one column with today's date or 'No case' then the column will need to be a string, whereas DateTimeToday is going to return a date. I think wrapping it in ToString() as part of your formula should work.

jeetamar11
7 - Meteor

Column name needs to be same as it is. i just need to replace the data that has today's date, with a string "No case". The data in the column is datetime type

alexnajm
17 - Castor
17 - Castor

You cannot store "No case" in a column that is a Date data type - it will have to be a String data type in that scenario.

JamesCharnley
13 - Pulsar

You won't be able to keep the datetime data type if you want a string value of 'No Case'. You will need to create a new string column and rename it to the same name later

NMangera
10 - Fireball

@jeetamar11 

 

if you'd like to display 'No Case' the data type needs to be a string, which means no date functions downstream in the workflow. To replace all the dates with today's date and blanks to 'No Case' the formula tool would look something like the screenshot

 

converttodaysdate&blankstoNoCase.png

jeetamar11
7 - Meteor

Thank you, great help!

Labels