web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / IF and OR functions on...
Power Apps
Unanswered

IF and OR functions on DisplayMode...

(0) ShareShare
ReportReport
Posted on by 802

Hi,

 

I have a button control which I want to be Disabled by default, and only change to Edit (and therefore be 'clickable') when the following conditions are met. However, there are multiple conditions which could be met - first things first... Here is the current code...

If(
 Toggle5.Value = true && !IsBlank(DataCardValue11.Text),
 Edit,
 Toggle3.Value = true && !IsBlank(ComboBox3.SelectedItems), Edit,
 Toggle3.Value = true && Toggle1.Value = true && Len(DataCardValue12.Text) = 6 && Len(DataCardValue10.Text) = 8 && !IsBlank(DataCardValue7.Text) && !IsBlank(DataCardValue8.Text) && !IsBlank(ComboBox3.SelectedItems),
 Edit,
 Toggle2.Value = true && !IsEmpty(ComboBox2.SelectedItems),
 Edit,
 Toggle1.Value = true && Len(DataCardValue12.Text) = 6 && Len(DataCardValue10.Text) = 8 && !IsBlank(DataCardValue7.Text) && !IsBlank(DataCardValue8.Text),
 Edit,
 Disabled
)

 

What I am struggling with is the Toggle 3 lines in the above. 

 

So if Toggle3.Value is true

AND ComboBox3 IS NOT blank,

allow Edit....

 

OR   

 

if Toggle3.Value AND Toggle1.Value both are true  (ensure the following conditions are evaluated)

AND ComboBox3 IS NOT blank,

AND Len(DataCardValue12.Text) = 6

AND Len(DataCardValue10.Text) = 8

AND DataCardValue7.Text IS NOT blank

AND DataCardValue8.Text IS NOT blank

allow Edit

 

The difficulty I am facing is that, although the Submit button is disabled by default, when Toggle3 and Toggle1 are set to true, the Submit button goes straight into Edit... but the conditions for WHEN both of these are set to true is not being evaluated...

 

What am I doing wrong?

 

Thanks

K.

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Kosenurm 

    Skip all the If's and lay out your conditions with Boolean OR's to determine what is valid.

    Please consider changing your Formula to the following:

    If(
     (Toggle5.Value && !IsBlank(DataCardValue11.Text) ||
     (Toggle3.Value && !IsBlank(ComboBox3.Selected.Value) ||
     (Toggle2.Value && !IsBlank(ComboBox2.Selected.Value) ||
     (Toggle1.Value && (Len(DataCardValue12.Text) = 6) && (Len(DataCardValue10.Text) = 😎 && !IsBlank(DataCardValue7.Text) && !IsBlank(DataCardValue8.Text)) ||
     (Toggle3.Value && Toggle1.Value && (Len(DataCardValue12.Text) = 6) && (Len(DataCardValue10.Text) = 😎 && !IsBlank(DataCardValue7.Text) && !IsBlank(DataCardValue8.Text) && !IsBlank(ComboBox3.Selected.Value),
     Edit,
     Disabled
    )

    Look at it as, if the first line is true, then it will be edit, if the second line is true, then edit...etc.

    If any one is true, then it will be edit.

     

    The above can be further simplified, but this is the basic concept.

     

    Also, avoid using IsEmpty as this will not return what you think.  Use IsBlank and check the Selected value (note, Value might not be a valid column of your combobox items, so replace with a valid column name in the above.)

     

    I hope this is helpful for you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard