Alteryx Designer Desktop Discussions

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

How to Check if String is a Valid Date WITHOUT throwing a conversion error

msmith6986
7 - Meteor

I am stuck on a simple date test that I just cannot figure out.

 

I am testing whether a string is a valid date field or not.  My method works, however when the string is not a valid date, it throws a conversion error which kills my workflow.  Anyone know how to accomplish this task WITHOUT throwing a conversion error?

 

IF IsNull(DateTimeParse([DateField], "%y-%m-%d")) THEN
   "Not a date"
ELSE
   "Date"
ENDIF

 

Thanks so much in advance.

 

2 REPLIES 2
grossal
15 - Aurora
15 - Aurora

Hi @msmith6986,

 

first of all: What are your working settings? It's very uncommon that a workflows stops when you have conversion error. Maybe uncheck the "Stop Processing When Limit is Reached" in the workflow settings.

 

grossal_0-1588281073747.png

 

However: Here is a solution to your question: Use Regex Match.

 

Example output:

grossal_2-1588281220729.png

 

 

Settings:

grossal_3-1588281236838.png

 

Workflow is attached. Let me know what you think.

 

Best

Alex

msmith6986
7 - Meteor

Works like a charm!  Thank you!

 

Labels