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

Count checkboxes checked

How do you count the amount of text boxes checked in a label.  I think it would be CountRows(Checkbox. ---, but I am not sure what comes next because I don't see a selected or check option. ClearCollect(
col,
{Result: "All"}
);
Collect(
col,
Sort(
Distinct(
CCB,
'Functional Area'
),
Result
)
); ClearCollect(
colCCB,
AddColumns(
CCB,
"Checked",
false
)
); 

I already have this in my on visible for the screen. 

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

This statement is in my default for the checkboxes. It populates the data previously selected by the user so their past selections are there. I need the label to still display however many are currently checked even if the user hasnt checked any new ones since reloading the app.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @powerapps890 ,

Regarding your original issue, you just want to count the checked Checkboxed inside your Gallery, I think the formula I provided above could achieve your needs. Please try it, check if it could help.

If the solution I provided above could solve your original issue, please consider go ahead to click "Accept as Solution" to identify my reply as helpful.

 

For your latest reply, I think it is related to another issue that you want to fix. If you want to restrict the user checking only 10 Checkboxes at most, please try the following workaround:

Add a Label (Label1) outside the Gallery, set the Text property to following:

CountRows(Filter(Gallery1.AllItems, Checkbox1.Value=true))

Set the visible property of the Label to following:

false

 

Set the DisplayMode property of the Checkbox in your Gallery to following:

If(
    Value(Label1.Text) = 10,
    DisplayMode.Disabled,
    DisplayMode.Edit
)

you could consider add a "Reset" button outside the Gallery, set the OnSelect property to following:

Set(IsReset, false);Set(IsReset, true)

set the Reset property of the Checkbox inside the Gallery to following:

IsReset

Please try above solution, check if the issue is solved.

 

If you still have other issue related your scenario, please consider close this thread, then open a new thread in our community, then we could help you there.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xida-msft
Community Support
Community Support

Hi @powerapps890 ,

Do you want to count the amount of Checkbox which is checked inside your Gallery?

 

If you add a Checkbox control inside a Gallery control, and you want to count the amount of Checkbox which is checked inside your Gallery, please try the following formula:

Set the Text property of the Label to following:

CountRows(
          Filter(
                 Gallery1.AllItems,   // Gallery1 represrnts the Gallery in your app, please replace it with your own Gallery name
                 Checkbox1.Value = true
          )
)

 

Please take a try with above formula, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Filter(
CCB,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
'Functional Area' in ComboBox1.SelectedItems
) &&
If(
IsBlank(Filter.Text),
true,
Filter.Text in 'Requirement Source'
) &&
If(
IsBlank(Search_.Text),
true,
Search_.Text in Name
)
)

 

This doesnt I think because I already filter in my items in the gallery. I only allow 10 selected boxes by the user and when you go back in the app after submitting it wont let you check anymore boxes than you previously checked even though you are allowed to select 10 in the code. @v-xida-msft 

Hi @powerapps890 ,

Regarding your original issue, you just want to count the checked Checkboxed inside your Gallery, I think the formula I provided above could achieve your needs. Please try it, check if it could help.

If the solution I provided above could solve your original issue, please consider go ahead to click "Accept as Solution" to identify my reply as helpful.

 

For your latest reply, I think it is related to another issue that you want to fix. If you want to restrict the user checking only 10 Checkboxes at most, please try the following workaround:

Add a Label (Label1) outside the Gallery, set the Text property to following:

CountRows(Filter(Gallery1.AllItems, Checkbox1.Value=true))

Set the visible property of the Label to following:

false

 

Set the DisplayMode property of the Checkbox in your Gallery to following:

If(
    Value(Label1.Text) = 10,
    DisplayMode.Disabled,
    DisplayMode.Edit
)

you could consider add a "Reset" button outside the Gallery, set the OnSelect property to following:

Set(IsReset, false);Set(IsReset, true)

set the Reset property of the Checkbox inside the Gallery to following:

IsReset

Please try above solution, check if the issue is solved.

 

If you still have other issue related your scenario, please consider close this thread, then open a new thread in our community, then we could help you there.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (77,407)