community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
SOLVED

Regarding AND Operator

Asteroid
Hi ,

I have a file in which I have to add a new field "Index2" . So I used the Formula tool and wrote  "IF [Index] == '5' and [Index] == '5.1' THEN 1 ELSE null() ENDIF"   But it gives only null values. I want to check both values and not one. Hence, I use "and". When, I use Boolean operators- or ,OR , || , it gives values for  [Index] == '5' only. So, how do I get the value 1 if  both conditions are true? If both condition are not satisfied then the output should be "null".
 
IndexNameValue
5F30
5F40
5F50
5F60
5F70
5F80
5F90
5F100
5.1F3933491
5.1F4618520
5.1F51033364
5.1F6937850
5.1F71777408
5.1F8561006
5.1F9847674
5.1F10954346
Founder
Founder
You are looking for the OR operator.  The AND operator is true if both sides are true.  The OR operator is true if either side is true, which is what you are looking for.
Asteroid
I want to check both Condition for true if its true then 1 else 0 . AND Operator didnt work here it gives only null values.
Have you tried using IN?

IF [INDEX] IN ("5","5.1") THEN "1" ELSE  NULL() ENDIF
Labels