cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KeithPowell
Frequent Visitor

Or operator is working as and operator

Hi,

I am trying to disable a button based on  the following conditions:-

All text and dropdowns have something in them and at least one of six checkboxes are selected.

 

When I enter the following into the DisplayMode:-

If(IsBlank(comboboxCentreName.Selected) And IsBlank(comboboxQualificationName.Selected) Or (Checkbox1.Value) Or (Checkbox2.Value),Disabled,Edit)

 

The button is visible and if I select one or more checkboxes it disappears, I know this is due to the first two returning false when selected and the checkboxes returning true when selected.

 

If I prefix the checkboxes with ! , the button is disabled, but I now have to select both boxes to get the button to appear.

 

Any idea what i am doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
achi
Advocate III
Advocate III

Hello @KeithPowell 

As checkboxes are boolean (0 or 1), you can just sum them up and compare, whether the sum is > 0.

Then just add your 2 comboxes into the condition and you should be all set:

 

If( 
    !IsBlank(ComboBox1.Selected) 
    && !IsBlank(ComboBox2.Selected) 
    && Sum(Checkbox1.Value,Checkbox2.Value,Checkbox3.Value,Checkbox4.Value) > 0
    , DisplayMode.Edit
    , DisplayMode.Disabled
)

 

Regards

Achi

 

 

 

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @KeithPowell ,

Two things - you need to state the IsBlank() on each and also bracket the Or() away from the And()

If(
   IsBlank(comboboxCentreName.Selected) &&
   (
      IsBlank(comboboxQualificationName.Selected) ||
      IsBlank(Checkbox1.Value) ||
      IsBlank(Checkbox2.Value)
   ),
   Disabled,
   Edit
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

KeithPowell
Frequent Visitor

Hi, @WarrenBelz ,

Thank you for getting back to me.

I have used the code you sent me, but the button stays permanently visible, no matter what I select. I have changed the code slightly as I want both comboboxes to have to be selected as well as on or more of the checkboxes.

If(
   IsBlank(comboboxCentreName.Selected) &&
   IsBlank(comboboxQualificationName.Selected) &&
   ( 
      IsBlank(Checkbox1.Value) ||
      IsBlank(Checkbox2.Value)
   ),
   Disabled,
   Edit
)


@KeithPowell ,

This is a logic more than a coding exercise - I can only guess what you need exactly and was supplying syntax to assist. For example this code

If(
   IsBlank(comboboxCentreName.Selected) &&
   IsBlank(comboboxQualificationName.Selected) &&
   ( 
      IsBlank(Checkbox1.Value) ||
      IsBlank(Checkbox2.Value)
   ),
   Disabled,
   Edit
)

will disable the check box if

  • CentreName is blank AND
  • QualificationName is blank AND
  • either CheckBox1 OR Checkbox2 is blank

What is the logic you need different from this?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Checkbox.Value is a a boolean value (true/false) so if the CheckBox OnCheck Property is true, you can try this:
 
If( IsBlank(comboboxCentreName.Selected.Value) && IsBlank(comboboxQualificationName.Selected.Value) || Checkbox1.Value = false && Checkbox2.Value = false, Disabled, Edit )

achi
Advocate III
Advocate III

Hello @KeithPowell 

As checkboxes are boolean (0 or 1), you can just sum them up and compare, whether the sum is > 0.

Then just add your 2 comboxes into the condition and you should be all set:

 

If( 
    !IsBlank(ComboBox1.Selected) 
    && !IsBlank(ComboBox2.Selected) 
    && Sum(Checkbox1.Value,Checkbox2.Value,Checkbox3.Value,Checkbox4.Value) > 0
    , DisplayMode.Edit
    , DisplayMode.Disabled
)

 

Regards

Achi

 

 

 

View solution in original post

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 (1,632)