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

Deleting an item from a gallery based on a Collection()

Hi all,

 

I guess this is a fairly simple issue, however, I just can't figure out how to go about this.

 

I have a gallery in which I can edit and delete an item. I want to base it on a collection instead to improve performance, but now my formula to delete the item doesn't work anymore:

 

Select(Parent);Remove(colPlannedTimeTable,ProjectCostsGallery.Selected);ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')

 

It used to work like this:

 

Select(Parent);Remove('Planned Project Costs Consultants Weekly',ProjectCostsGallery.Selected)
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Post Prodigy
Post Prodigy

Re: Deleting an item from a gallery based on a Collection()

This did it for me in case people will be able to use it in the future:

 

Remove(colPlannedTimeTable,ProjectCostsGallery.Selected);

Remove('Planned Project Costs Consultants Weekly', LookUp('Planned Project Costs Consultants Weekly', PlannedProjectIDCard.Text = ID));

ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Deleting an item from a gallery based on a Collection()

Hi @AndersIskov :

Could you tell me :

  • Has your problem been solved? If yes, please mark your solution as a solution so that more people can see it.
  • What is the definition of "colPlannedTimeTable"? Is it just to save the values in'Planned Project Costs Consultants Weekly' in this collection?

Firstly,let me explain why you encounted this probelm.

The key is that the corresponding record in the data source has not been deleted.Therefore, when ‘ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')’ is executed, the data in the data source overwrites the data in the collection, causing the record to appear not to be deleted.

Secondly,please try this code:

 

Remove('Planned Project Costs Consultants Weekly',LookUp('Planned Project Costs Consultants Weekly',ID=ProjectCostsGallery.Selected.ID);
Remove(colPlannedTimeTable,ProjectCostsGallery.Selected);
ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')

 

Best Regards,

Bof

View solution in original post

3 REPLIES 3
Highlighted
Post Prodigy
Post Prodigy

Re: Deleting an item from a gallery based on a Collection()

This did it for me in case people will be able to use it in the future:

 

Remove(colPlannedTimeTable,ProjectCostsGallery.Selected);

Remove('Planned Project Costs Consultants Weekly', LookUp('Planned Project Costs Consultants Weekly', PlannedProjectIDCard.Text = ID));

ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')

View solution in original post

Highlighted
Microsoft
Microsoft

Re: Deleting an item from a gallery based on a Collection()

Hi @AndersIskov :

Could you tell me :

  • Has your problem been solved? If yes, please mark your solution as a solution so that more people can see it.
  • What is the definition of "colPlannedTimeTable"? Is it just to save the values in'Planned Project Costs Consultants Weekly' in this collection?

Firstly,let me explain why you encounted this probelm.

The key is that the corresponding record in the data source has not been deleted.Therefore, when ‘ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')’ is executed, the data in the data source overwrites the data in the collection, causing the record to appear not to be deleted.

Secondly,please try this code:

 

Remove('Planned Project Costs Consultants Weekly',LookUp('Planned Project Costs Consultants Weekly',ID=ProjectCostsGallery.Selected.ID);
Remove(colPlannedTimeTable,ProjectCostsGallery.Selected);
ClearCollect(colPlannedTimeTable,'Planned Project Costs Consultants Weekly')

 

Best Regards,

Bof

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: Deleting an item from a gallery based on a Collection()

@v-bofeng-msft 

 

The solution I posted above does the job for me. I have marked it as a solution, will also mark yours since it might help people in the future explore why this might occur. 

 

Thank you.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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