Free Trial

Alteryx Designer Desktop Discussions

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

How to combine If/AND

Pramod91
8 - Asteroid

Hello everyone,

 

I have the following formula to check if the fields contains a valid date (dd/mm/yyyy).

if
!isnull(DateTimeParse([_CurrentField_],'%d/%m/%Y')) then 'Valid'

else 'Not Valid' endif

 

But, I want this formula to only check for those rows which do not contains "-" in the fields. How can I do this? Can someone help??

3 REPLIES 3
kelvin_law1
9 - Comet

You can use IF and ELSE IF, maybe something like:

 

if Contains([_CurrentField_],"-") then "Valid"

else if !isnull(DateTimeParse([_CurrentField_],'%d/%m/%Y')) then 'Valid'

else 'Not Valid' endif

endif

DavidP
17 - Castor
17 - Castor

Hi @Pramod91 

 

It looks like you're using a Multi-Field Formula tool? When you say "rows", do you mean that all the dates in a specific row would either have "-" or not?

 

If this is the case, you can maybe use a filter tool on one of the date fields with a !Contains([Fieldname],"-") expression, then connect the True output to your Multi-Field tool and Union the result with the False output.

 

If this is not the case and you can't use the filter option and you need to evaluate each date cell individually, then you could perhaps write an expression like:

 

if !Contains([_CurrentField_],"-") then

 

if !isnull(DateTimeParse([_CurrentField_],'%d/%m/%Y')) then 'Valid' else 'Not Valid' endif

 

else [_CurrentField_] endif

Pramod91
8 - Asteroid

Thanks a lot @DavidP , it works!

Labels
Top Solution Authors