cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

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.

 

Highlighted
Frequent Visitor

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

Highlighted

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.

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

Highlighted

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.

Highlighted
Frequent Visitor

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

Highlighted

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.

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

Highlighted

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,635)