cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jackson_Dhorty
Helper III
Helper III

Checking multiple conditions

Hi everyone,

 

I have a new form in power apps which contains 4 fields.

1- item list  //dropdown

4- amount // textbox

2- currency  //dropdown

3-date  //datepicker

 

Next I have share point list (Name: Warning_List) which contains: id, items(lookup from different SP list), currency(lookup from different SP list), Date from and Date to column( contains date), threshold amount (contains threshold amount)  and message.

 

When I submit a save button, I want to check all 4 fields in a form in my Warning_List. First check selected item and selected currency, if they match then check selected date is in date from and date to column and then if amount is > threshold amount ,popup warning card with message.  If selected item match and currency doesn't match then do nothing and proceed.)

 

Can someone please tell me how to check more than 2 conditions?

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions

@Jackson_Dhorty 

 

If the Condition only has one action for true and one action for false, use the && operator to change what returns true and false by having more than one condition there.

 

Example:

 

If(SomeTrueFalseClause1 && SomeTrueFalseClause2, true,false)

 

In the above example:

If SomeTrueFalseClause1 or SomeTrueFalseClause2 returns false, it does not matter if one of them returned true - if either are false, the whole If formula will evaluate the false branch - because all it says in the false branch is false, that means the whole If formula itself just returns the boolean false.

 

On the other hand, if SomeTrueFalseClause1 or SomeTrueFalseClause2 both return true, then the true side is evaluated - in this case, the true side just says true, that means the whole If formula itself just returns the boolean true.

 

 

If the Condition has more than two possible actions at nested depth level you would do it like this instead:

 

If(SomeTrueOrFalseExpression
   ,
   If(SomeLEVEL2TrueOrFalseExpression
     ,
     SomeLEVEL2FormulaWhenTRUE
     , 
     SomeLEVEL2FormulaWhenFALSE
   )
   ,
   SomeLevel1FormulaWhenFalse
)

 

 

In the above example:

 

If the SomeTrueOrFalse Expression returns true AND the SomeLEVEL2TrueOrFalseExpression are both true, only then does the SomeLEVEL2FormulaWhenTRUE get evaluated.

 

On the other hand, if the  SomeTrueOrFalse Expression returns false then  SomeLevel1FormulaWhenFalse is the one that gets evaluated.

 

You can apply either of the above, or even both simultaneously, to your scenario as you see fit. While you can go as complex as you want with the nested If statements, recommend you only keep them to the minimum needed to achieve the objective, only because they may become hard to maintain. If possible, try to indent it and place the commas and parentheses in that kind of specific way we did in the example as well so you could keep track of them more easily if and when you must use the nested conditions.

View solution in original post

2 REPLIES 2

@Jackson_Dhorty 

 

If the Condition only has one action for true and one action for false, use the && operator to change what returns true and false by having more than one condition there.

 

Example:

 

If(SomeTrueFalseClause1 && SomeTrueFalseClause2, true,false)

 

In the above example:

If SomeTrueFalseClause1 or SomeTrueFalseClause2 returns false, it does not matter if one of them returned true - if either are false, the whole If formula will evaluate the false branch - because all it says in the false branch is false, that means the whole If formula itself just returns the boolean false.

 

On the other hand, if SomeTrueFalseClause1 or SomeTrueFalseClause2 both return true, then the true side is evaluated - in this case, the true side just says true, that means the whole If formula itself just returns the boolean true.

 

 

If the Condition has more than two possible actions at nested depth level you would do it like this instead:

 

If(SomeTrueOrFalseExpression
   ,
   If(SomeLEVEL2TrueOrFalseExpression
     ,
     SomeLEVEL2FormulaWhenTRUE
     , 
     SomeLEVEL2FormulaWhenFALSE
   )
   ,
   SomeLevel1FormulaWhenFalse
)

 

 

In the above example:

 

If the SomeTrueOrFalse Expression returns true AND the SomeLEVEL2TrueOrFalseExpression are both true, only then does the SomeLEVEL2FormulaWhenTRUE get evaluated.

 

On the other hand, if the  SomeTrueOrFalse Expression returns false then  SomeLevel1FormulaWhenFalse is the one that gets evaluated.

 

You can apply either of the above, or even both simultaneously, to your scenario as you see fit. While you can go as complex as you want with the nested If statements, recommend you only keep them to the minimum needed to achieve the objective, only because they may become hard to maintain. If possible, try to indent it and place the commas and parentheses in that kind of specific way we did in the example as well so you could keep track of them more easily if and when you must use the nested conditions.

Thank you for your response. Appreciate your help

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,065)