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
poweractivate
Community Champion
Community Champion

@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
poweractivate
Community Champion
Community Champion

@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

Thank you for your response. Appreciate your help

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,654)