cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

Limiting checkbox selection to 10

p.jpg

I want to limit the checkbox selection amount to 10. How can I do this? 

3 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @powerapps890 ,


Change it as below:

Collect(collCheckBoxes,{SelCheckBoxID:"Checked"})


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more. 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

@powerapps890 

Another approach you might consider...a Toggle control.

Place a toggle control on your screen (not in your Gallery) - let's call it tglMaxChecks.  Set the Default Property to:  

 

CountRows(Filter(YourGalleryName.AllItems, yourCheckBoxControl.Value))>9

 

 On your Checkbox Control in your Gallery, set the DisplayMode to the following:

 

If(!tglMaxChecks.Value || YourCheckBox.Value, DisplayMode.Edit, Disabled)

 

This will allow your users to check 10 checkboxes.  Once they check 10, the checkboxes will go "disabled", except for the ones already checked (so they can uncheck if they desire).  

 

Just another approach but no variables or collections needed.

 

EDIT: Oh, and you would also want to make the Toggle Visible property false.

_____________________________________________________________________________________
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.
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

Hi @powerapps890 ,

 

on default use:

If(ThisItem.Title in Filter('CCB Voting','Created By'.Email = varUser.Email).Title || ThisItem.ID in TempCollection.Value, true,false)

on DisplayMode use this:
 

If(
    (CountRows(TempCollection)<10 && CountRows(Filter(
                'CCB Voting',
                'Created By'.Email = varUser.Email
            )) < 10),
    DisplayMode.Edit,
    If(
        If(
            ThisItem.Title in Filter(
                'CCB Voting',
                'Created By'.Email = varUser.Email
            ).Title,
           true,
            false
        ) || If(
            ThisItem.ID in TempCollection.Value,
            true,
            false
        ),
        DisplayMode.Edit,
        DisplayMode.Disabled
    )
)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

7 REPLIES 7
RezaDorrani
Dual Super User II
Dual Super User II

Hi @powerapps890 

 

Every time check box is checked or unchecked - load the information to a collection.

 

Then check collection count using CountRows function and apply the logic to disable your checkboxes.

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Thanks,
Reza Dorrani, MVP
YouTube
Twitter 

KrishnaV
Super User
Super User

Hi @powerapps890 ,

just to elaborate on what @RezaDorrani advised, do the below steps:

  1. set this on OnCheck property of the checkbox

 

Collect(collCheckBoxes,{selCheckBoxID:ThisItem.ID})​

 

  • Set this on DisplayMode property of the CheckBox

 

if(CountRows(collCheckBoxes)=10,DisplayMode.Disabled,DisplayMode.Edit)​

 

I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Annotation 2020-07-08 152614.jpg

This is the error I got. @KrishnaV 

Hi @powerapps890 ,


Change it as below:

Collect(collCheckBoxes,{SelCheckBoxID:"Checked"})


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more. 


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

@powerapps890 

Another approach you might consider...a Toggle control.

Place a toggle control on your screen (not in your Gallery) - let's call it tglMaxChecks.  Set the Default Property to:  

 

CountRows(Filter(YourGalleryName.AllItems, yourCheckBoxControl.Value))>9

 

 On your Checkbox Control in your Gallery, set the DisplayMode to the following:

 

If(!tglMaxChecks.Value || YourCheckBox.Value, DisplayMode.Edit, Disabled)

 

This will allow your users to check 10 checkboxes.  Once they check 10, the checkboxes will go "disabled", except for the ones already checked (so they can uncheck if they desire).  

 

Just another approach but no variables or collections needed.

 

EDIT: Oh, and you would also want to make the Toggle Visible property false.

_____________________________________________________________________________________
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.
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

This works, but every time I use my filter I can then select 10 checkboxes filtering on that whereas I want 10 checkboxes allowed in the entire app. I also already have data from previous answers populated. Including those I want the user to have to uncheck them to make additional selections. This only works for me if I don't filter. @RandyHayes @KrishnaV 

Hi @powerapps890 ,

 

on default use:

If(ThisItem.Title in Filter('CCB Voting','Created By'.Email = varUser.Email).Title || ThisItem.ID in TempCollection.Value, true,false)

on DisplayMode use this:
 

If(
    (CountRows(TempCollection)<10 && CountRows(Filter(
                'CCB Voting',
                'Created By'.Email = varUser.Email
            )) < 10),
    DisplayMode.Edit,
    If(
        If(
            ThisItem.Title in Filter(
                'CCB Voting',
                'Created By'.Email = varUser.Email
            ).Title,
           true,
            false
        ) || If(
            ThisItem.ID in TempCollection.Value,
            true,
            false
        ),
        DisplayMode.Edit,
        DisplayMode.Disabled
    )
)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

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!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,412)