Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Remove items in gallery function not deleting the correct items - random items are deleted instead

Hi all,


I have created an Repeating table in a gallery connected to the collection, the items in the gallery gets patched to a collection with a button outside of the gallery. This is eventually patched to a sharepoint list.


The issue I face is that when I create a delete button inside the gallery item as below, it does not delete the item that I intended it to.






For example, in the image attached, I created 5 items in the repeating table

The items are only saved and patched to the ServerCollection when I click save, and the form is then submitted and all data is patched to Sharepoint.

If i click delete on row 4, it is not guaranteed that row 4 is deleted. while it's pretty random, Mostly row 2 gets deleted first, then 3 etc. If I delete row 1, row 1 is successfully deleted.


Where did I go wrong here? Is it possibly because I have not yet patched items into the collection yet?

How can I ensure that I can delete the correct items in the gallery before patching it?


Thank you!

Helper II
Helper II

Did you try this one - 


On the Delete put this formula on OnSelelect:


(tried this for SharePoint list item directly and it works, not entirely sure if it holds true for collection too)

Frequent Visitor


Sorry if I used the wrong term. It's not a editable table, but a repeating table. So I don't want to delete the item in sharepoint.


What I would like to achieve is option to delete the items that I am creating it in the gallery, before adding it to the sharepoint list.

Lets say I've made a mistake, and don't need this line item anymore. 

Your formula is intended to delete the item from the source sharepoint I think (like an editable table) so that's not what I'm looking for.


Helper I
Helper I

Have you tried this function :  RemoveIf(ServerCollection, ID = ThisItem.ID)

This should work

Frequent Visitor


I just tried this code

RemoveIf(ServerCollection, LineMoniS = ThisItem.LineMoniS)

LineMoniS is the first cell on the left.

Now it just deletes the whole collection when I press the delete icon (I attached a gif of its behavior)


Originally with the below code, my rows were deleting at random (ish).

Remove(ServerCollection, ThisItem)

 For some reason with the same code, now it is consistently deleting the top row first (I also inserted a gif to show this)


I'm really not sure where I went wrong and what I need to fix here.

Helpful resources

2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,639)