Alteryx Designer Desktop Discussions

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

IF Expression Issue

amandaj4123
7 - Meteor

Hi!  I have attempted the below formula several times, rearranged, used " " instead of IsNull, but my results are still incorrect.  I could use some input on how to resolve.  

 

IF [A]="Non-Test" && [C]!="" THEN "" ELSEIF [A]="TEST" && IsNull([C]) THEN "" ELSEIF [A]="TEST1" && IsNull([C]) THEN "" ELSEIF [A]="TEST2" && IsNull([C]) THEN "" ELSEIF [A]="TEST3" && IsNull([C]) THEN "" ELSE "Validation Required" ENDIF 

 

I am trying to achieve the following...

 

1) IF [A] = Non-Test AND [C] is blank THEN "Validation Required"

2) IF [A] = TEST, TEST1, TEST2, TEST3 is NOT blank THEN "Validation Required"

 

Thanks,

 

Mandy

11 REPLIES 11
amandaj4123
7 - Meteor

Correction to what I'm trying to achieve...

 

1) IF [A] = Non-Test AND [C] is blank THEN "Validation Required"

2) IF [A] = TEST, TEST1, TEST2, TEST3 AND [C] is NOT blank THEN "Validation Required"

patrick_digan
17 - Castor
17 - Castor

Can you post some quick sample data perhaps showing the data and what you expect the result to be? Here is my best guess:

 

IF ([A] = "Non-Test" && isempty([C])) Then "Validation Required" ELSEIF ([A] IN ("Test","Test1","Test2","Test3") && !isempty([C])) Then "Validation Required" ELSE "" ENDIF

I'm hoping you can use the isempty function on C, and I used an IN function for A.

 

Hope that helps!

MarqueeCrew
20 - Arcturus
20 - Arcturus

How about ....

 

IF  
       [A] In ('Non-Test','TEST', 'TEST1', 'TEST2', 'TEST3')
       AND
       !IsEmpty([C])
       THEN '"Validation Required"
ELSE
""
ENDIF

That's one approach.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
amandaj4123
7 - Meteor

Let me try to better explain the expectation...I hope this helps.  Thank you!

 

When [A] = [Null] this is an error and I want to insert "Validation Required".

When [C] is not [Null] this is an error and I want to insert "Validation Required".

 
Sample DataSample Data

Mandy

amandaj4123
7 - Meteor

OMG!  This is reason to step away and re-group!  Sorry!

 

When [A] = "Non-Test" & [C] = [Null] this is an error and I want to insert "Validation Required".

When [A] = "TEST" & [C] is not [Null] this is an error and I want to insert "Validation Required".

MarqueeCrew
20 - Arcturus
20 - Arcturus
IF  
     ([A] = 'Non-Test' AND IsNull([C])) or ([A] = 'Test' AND !IsNull([C]))   THEN "Validation Required"
ELSE
""
ENDIF

When [A] = "Non-Test" & [C] = [Null] this is an error and I want to insert "Validation Required".

When [A] = "TEST" & [C] is not [Null] this is an error and I want to insert "Validation Required".

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
amandaj4123
7 - Meteor

I see where you're going, but [A] will never be [Null].  [A] will always be "Non-Test" or "TEST".  I would like to insert "Validation Required" in a new column, only if the following occurs...

 

[A] = "Non-Test" & [C] = [Null] THEN "Validation Required"

 

[A] = "TEST" & [C] is not blank or [Null] THEN "Validation Required"

 

Does that help?

 

 

MarqueeCrew
20 - Arcturus
20 - Arcturus

Capture.png

 

IF  
     ([A] = 'Non-Test' AND IsNull([C])) or ([A] = 'Test' AND !IsNull([C]))   THEN "Validation Required"
ELSE
""
ENDIF

I think that it works....

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
amandaj4123
7 - Meteor

Shut the front door!  You are absolutely correct, it works!  Thank you very much!

 

Salute,

 

Mandy

Labels