SOLVED
Regarding AND Operator
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
ashiques
8 - Asteroid
‎12-04-2014
01:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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".
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".
Index | Name | Value |
5 | F3 | 0 |
5 | F4 | 0 |
5 | F5 | 0 |
5 | F6 | 0 |
5 | F7 | 0 |
5 | F8 | 0 |
5 | F9 | 0 |
5 | F10 | 0 |
5.1 | F3 | 933491 |
5.1 | F4 | 618520 |
5.1 | F5 | 1033364 |
5.1 | F6 | 937850 |
5.1 | F7 | 1777408 |
5.1 | F8 | 561006 |
5.1 | F9 | 847674 |
5.1 | F10 | 954346 |
Solved! Go to Solution.
Labels:
- Labels:
- Preparation
3 REPLIES 3
Ned
Alteryx Alumni (Retired)
‎12-04-2014
02:05 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
‎12-05-2014
09:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
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.
amyralene
5 - Atom
‎01-12-2015
04:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Have you tried using IN?
IF [INDEX] IN ("5","5.1") THEN "1" ELSE NULL() ENDIF
IF [INDEX] IN ("5","5.1") THEN "1" ELSE NULL() ENDIF
