cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

IF condition using Not equal to <>

Hi,

I would like to disable a button if the text in TextInput1 is not equal to "Y".

I tried using: If(TextInput1.Text <> "Y" || TextInput1.Text <> "y", DisplayMode.Disabled, DisplayMode.Edit)

but it doesn't seem to work. How could I better approach this?

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Anonymous 

Please consider changing your Formula to the following:

If(!(Upper(TextInput1.Text) = "Y"), DisplayMode.Disabled, DisplayMode.Edit)

 

This converts to Upper so you only need one condition and it also performs a ! (Not) on it to give the inequality.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
RandyHayes
Super User
Super User

@Anonymous 

Please consider changing your Formula to the following:

If(!(Upper(TextInput1.Text) = "Y"), DisplayMode.Disabled, DisplayMode.Edit)

 

This converts to Upper so you only need one condition and it also performs a ! (Not) on it to give the inequality.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

Awesome, thank you @RandyHayes ! it worked!

RandyHayes
Super User
Super User

@Anonymous 

🤣🤣 Oh my - Apparently I look at PowerApps formulas way too much.  When I first read your response I though..."Oh no, it's not working".   Why did I think this? Because I saw "! it worked"  My mind immediately took that as "NOT it worked".  Now I see that was the end of the first sentence!!

🤣😂

I am glad it worked for you!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Anonymous
Not applicable

😂🤣Haha! you're a wiz @RandyHayes but take a break sometimes.

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 (2,735)