cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
George2
Frequent Visitor

Checkbox OnUncheck does not work

Hello,

 

I am currently building a Canvas App and I added a Checkbox. For the OnCheck option I filled in "Collect(Collection1,ThisItem)", which seems to work fine. For the OnUncheck Option I filled in "Remove(Collection1,ThisItem)". However, this option does not work. I can uncheck items but they still show in the Collection. Besides, I get an error as shown in the picture enclosed. Does anyone know why the OnUncheck option does not work? I also added a button with the following DisplayMode "If(CountRows(Collection1) > 0, DisplayMode.Edit, DisplayMode.Disabled) ". Whenever I check a box it adds 10 items to the list and when I uncheck a box, it adds nine items. 

 

Thank you for your help!

12 REPLIES 12
eka24
Super User
Super User

Try Onuncheck

Remove(CollectionName,LookUp(CollectionName, ID = ThisItem.ID))

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

George2
Frequent Visitor

Thank you for the fast response. Unfortunately it still does not work 🤔

Can you show what you did. Do you have an ID field

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

George2
Frequent Visitor

Yes sure, how shall I share it? Sorry, I am quite new with Power Apps. And I do have an ID field in the data source, if that is what you mean. 

If you have an ID filed in the Datasource that is fine. Please take a screen shot of the formula of the OnUncheck in your app that is not working.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

George2
Frequent Visitor

Please find enclosed the screenshot. Thank you for your help. 

It means you didn't use the formula I gave.

Remove(Collection1,LookUp(Collection1, ID = ThisItem.ID))

 

If your ID field is not called "ID", change it in the formula to the name you have.

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

George2
Frequent Visitor

Yes, that's true. I changed it back. When I use this formula, the error disappears but it still does not unselect. But I am also not completely sure with which value I have to replace the ID.

What you have done is ok only if the category name is unique. That's no duplicate of same data in that field. What you have done will work.

 

If there are duplicate then show your table or Datasource.

 

The unselect will work in play mode, try using the app.

All is ok------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,180)