We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Multiple Field Condition

LeeZH1998
7 - Meteor

How do I set a condition for multiple fields for example the

If [Type of Fruit] is Apple/Orange and [Taste] is Sweet and [Colour] is Red/Green and [Storage Time] is more than 3 days, return Yes in [Good Fruit]

 

 

 

Input

    
Type of FruitTasteColourStorage Time
AppleSweetRed4 days 
OrangesSweetOrange3 days 
AppleSourGreen5 days 
PearSourGreen5 days 
     
Output    
Type of FruitTasteColourStorage TimeGood Fruit
AppleSweetRed4 daysYes
OrangesSweetOrange3 daysYes
AppleSourGreen5 daysNo
PearSourGreen5 daysNo

 

 

4 REPLIES 4
atcodedog05
22 - Nova
22 - Nova

Hi @LeeZH1998 ,

 

Here is the formula for Good Fruit

 

IF ([Type of Fruit] = "Apple" or [Type of Fruit] = "Orange") 
and ([Taste] = "Sweet") 
and ([Colour] = 'Red' or [Colour] = 'Green') 
and (ToNumber(Left([Storage Time], 1))>=3)
THEN 'Yes' ELSE 'No' ENDIF

 

Pst... you said for good fruit color is red or green your output has considered even orange as good. Add in the color group if needed

 

Workflow

atcodedog05_0-1601544484842.png

Output

atcodedog05_1-1601544501280.png

 

Hope this helps : )

 

If this helps please mark the post as solution. And give a like if you dont mind.

jdunkerley79
ACE Emeritus
ACE Emeritus

An expression like:

If [Type of Fruit] in ('Apple', 'Orange') and [Taste] = 'Sweet' 
 and [Colour] in ('Red', 'Green') and ToNumber(REGEX_Replace([Storage Time],"(\d+).*","$1")) > 3 
THEN 'Yes' ELSE 'No' ENDIF

 

should give you close to what you want

 

Have attached a sample

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @LeeZH1998 

 

Cheers and happy analysing : )

atcodedog05
22 - Nova
22 - Nova

Great use of "In" function @jdunkerley79 

Labels
Top Solution Authors