cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JBMac
Helper I
Helper I

Select single checkbox within a Gallery

 

I have a gallery that references available desks from a SharePoint List and displays them all in a list. When a user selects on the check box next to the desk, it sets that as the chosen desk. All works great

 

Issue I have is that a user can select the checkbox next to any / all available desks if they want to. It always sets the chosen desk to be the last one they selected (and displays the chosen desk to the side along with date and user) but ideally if they select Desk A, they will not be able to select Desk B until they have deselected Desk A

 

Is this possible to do with galleries? Or do we just need to accept that is how they work and live with the fact that they will get a desk and it is showing them the desk name before they navigate to the next screen?

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@JBMac 

Here is what you can do...

Create a label OUTSIDE of your gallery - let's call it lblCheckCount (you can make it not visible).

Set the Text property of the Label to : CountRows(Filter(yourGallery.AllItems, yourCheckBox.Value))

Now, for the checkboxes in your Gallery, set the DisplayMode to the following:

   If(Self.Value || (Value(lblCheckCount.Text)=0), DisplayMode.Edit, Disabled)

 

This will disable all the other Checkboxes if one is Checked.  If the checkbox is then unchecked, all will become available to check another.

 

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

7 REPLIES 7
RandyHayes
Super User
Super User

@JBMac 

Here is what you can do...

Create a label OUTSIDE of your gallery - let's call it lblCheckCount (you can make it not visible).

Set the Text property of the Label to : CountRows(Filter(yourGallery.AllItems, yourCheckBox.Value))

Now, for the checkboxes in your Gallery, set the DisplayMode to the following:

   If(Self.Value || (Value(lblCheckCount.Text)=0), DisplayMode.Edit, Disabled)

 

This will disable all the other Checkboxes if one is Checked.  If the checkbox is then unchecked, all will become available to check another.

 

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!

👏

 

Worked a treat, thank you @RandyHayes 

Amazing exactly what i was looking for, Thank you.

stevec1
Regular Visitor

Great - worked a treat.  Thank you for sharing! 

Worked - thank you!

@RandyHayes This worked great! Would you say it's a similar way of disabling items in gallery that have a specific Criteria?

Hello,

 

I know it has been a few while.

I hope you can help me out.

 

Your solution works in my scenario only visually. If checkbox is ticked, other check boxes are greyed out, however, if gallery itself or other checkbox is then pressed, it resets the gallery and other check boxes become available again. 

Testing -   I apologies for the horrendous quality, can't screen capture on work laptop.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,306)