cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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
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 

Super User III
Super User III

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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Kudoed Authors
Users online (80,233)