cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sienna28
Post Patron
Post Patron

How to use And/Or

How can I perform an And/or check behind a button
 
This one works fine
 
If(Value(Blood1.Text) >= 120 && Value(Blood1.Text) <=129  && Value(Blood2.Text) < 80 ,Set(colorset,"#ffff1a");Set(txtval,"ELEVATED"));
 
But what if I want to check two text box values using an and/or calculation?
If textbox1 > 80 and/Or  textbox2 > 120
 
Thanks
1 ACCEPTED SOLUTION

Accepted Solutions

@sienna28 

I know what the issue is... I needed to invert the order displayed on the chart when coding it, lol.

If(
    Value(Blood1.Text) > 180 Or Value(Blood2.Text) > 120,
    Red,
    Value(Blood1.Text) >=140 Or Value(Blood2.Text) >= 90,
    RedOrange,
    (Value(Blood1.Text) >= 130 Value(Blood1.Text) <= 139) And (Value(Blood2.Text) >= 80 Value(Blood2.Text) <= 89),
    Orange,
    (Value(Blood1.Text) >= 120 Value(Blood1.Text) <= 129) And Value(Blood2.Text) < 80,
    Yellow,
    Value(Blood1.Text) < 120 And Value(Blood2.Text) < 80,
    Green
)

 

View solution in original post

13 REPLIES 13
eka24
Super User
Super User

If(Value(Blood1.Text) >= 120 Or Value(Textbox2.Text) > 120&& Value(Blood1.Text) <=129  && Value(Blood2.Text) < 80 Or Value(Textbox1.Text) > 80,Set(colorset,"#ffff1a");Set(txtval,"ELEVATED"));

 

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

mdevaney
Super User
Super User

@sienna28 
Can you please clarify what you want to do with this code?  I don't understand having both the AND and the OR.

If textbox1 > 80 and/Or  textbox2 > 120


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Thanks for the reply.

 

It just needs to work for these values

 

If textbox1 > 80 and/Or  textbox2 > 120

 

@sienna28
I guess what i am asking here is do you want the condition to be AND or OR for your code above: it cannot be both.

Please see attached for explanation.

 

If you notice the second value is where the And/Or is done

 

 

Hi @sienna28 

In your example, the And is irrelevant.  If either value is outside of the range, the result will be flagged. I would just go with the Or condition.

@sienna28 

Based on your image I would set your conditions like this.

 

If(
    Value(Blood1.Text) >= 180 Or Value(Blood2.Text) >= 120,
    Set(colorset,"#ffff1a"),
    Set(txtval,"ELEVATED")
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

Hi

 

That looks like it could be it, but I am not sure how it reads.

Could you please explain that logic to me....does the 180 value come into it?

 

Many thanks

I've attached a better graphic which shows what I am trying to do.

 

Using the Or condition only in the last option triggers the one above it.

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,629)