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

Patch and unpatch checkbox

I want to patch and unpatch checkbox selections directly to my datasource. The problem is with my uncheck, it will only uncheck the first thing. How can I fix the uncheck so this will work?

Default - LookUp(TestResponses, Title=vUserMail && ListID = Text(ThisItem.C1)).CheckValue

 

OnCheck - Patch(TestResponses,
Coalesce(LookUp(TestResponses, Title=vUserMail && ListID=Text(ThisItem.C1)),
Defaults(TestResponses)
),
{Title: vUserMail, ListID: ThisItem.C1, CheckValue: Checkbox3.Value}
); UpdateIf(collTestMasterData, C1=ThisItem.C1, {C3:Self.Value})

 

On UnCheck - Remove(collTestMasterData, BrowseGallery1.Selected); Remove(TestResponses, LookUp(TestResponses, ID = BrowseGallery1.Selected.C1)); ClearCollect(collTestResponses, TestResponses);

6 REPLIES 6
Resident Rockstar
Resident Rockstar

Hi @powerapps890 ,

as i read your post , my suggestion and approach is below.

So 
1. Approach - of you want to simply remove the Record from the Souce on Uncheck then use code like below -

Remove(TimeSheetEntryBook,ThisItem);

2. Approach -

if you want to Update the Uncheck status at source then you can use the Code like below - 

Patch(SouceName,ThisItem,{ColumnsName:"Valueneed2Update"})

Thanks,
Hope this will help you to resolve your issue.

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay



 

I am confused what should mine look like? I tried to modify both formulas. Both formulas said they had invalid arguments. Also, wouldn't I need to use a lookup or remove based on the persons email? Many people will be using the app so it needs to be removed just for that person. @VijayTailor 

I don't know the difference. I just need it to be removed from the datasource and the collection. @VijayTailor 

Hi @powerapps890 ,

Then use like below.
For remove from the Source List

 

Remove(TimeSheetEntryBook,ThisItem);

 

 For Removing from the collection.

 

Remove(CollectionName,ThisItem);

Thanks,

Vijay

 

It says that the type is incompatible and the function remove has invalid arguments. The item removed needs to be based on that persons email C1 also gets the ID number of that item @VijayTailor 

In this requirement , Wrap the Remove function with if condition with the user and other validation true then only you can remove.

For Error Part can you please mention here which place and for which source you getting error?

 

Thanks,
Vijay 

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Check out the Power Apps Community Call for January 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

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