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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Checkbox Component Cou...
Power Apps
Unanswered

Checkbox Component Counter

(0) ShareShare
ReportReport
Posted on by 20

I have a component that has a label and a checkbox. I need to count the number of selected checkboxes and remove any checkbox selected. It displays the number selected just fine when only incrementing selections or removing the most recent selection. I cannot properly remove a selection in the middle.

 

Say I have checkboxes numbered 1, 2, 3, 4, 5. Now say I want to remove number 3 so numbers 4 and 5 need to be renumbered to 3 and 4, respectively but nothing I have come up with works.

 

Component properties:

ID: text (gets put into selectedCol collection as Selections column)

Number: number

 

Screen OnVisible:

ClearCollect(numberSelected , {Number:0}); //counts the number of checkboxes selected

ClearCollect(testAlpha,{Number:0,Selections:""});Clear(testAlpha);

ClearCollect(selectedCol,{Number:0,Selections:""});Clear(selectedCol)

 

Checkbox OnCheck (inside component):

Patch(numberCubesSelected, First(numberCubesSelected), {Number: First(numberCubesSelected).Number+1});

Patch(selectedCol,Defaults(selectedCol),{Number: First(numberCubesSelected).Number, Selections: CheckBoxComp.ID});

Patch(testAlpha,Defaults(testAlpha),{Number: First(numberCubesSelected).Number, Selections: CheckBoxComp.ID});

 

Checkbox OnUncheck (inside component😞

Patch(numberSelected,First(numberSelected),{Number: First(numberSelected).Number - 1});

Remove(selectedCol,First(Filter(selectedCol,Selections = CheckBoxComp.ID)));

Remove(testAlpha,First(Filter(testAlpha,Selections = CheckBoxComp.ID)));

ForAll(

    testAlpha,

    If(ThisRecord.Number > CheckBoxComp.numberSelected,

        Patch(selectedCol, LookUp(selectedCol, Selections = ThisRecord.Selections),{Number : ThisRecord.Number - 1})//Patch(Col)

    }

);

 

Label:

LookUp(selectedCol, Selections=CheckBoxComp.ID).Number

 

Any help would be appreciated!

Categories:

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard