cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sparky13
Level: Powered On

Remove ThisItem Removes Different Entry

I have gallery that has a collection as a data source.

 

Within the gallery, there is a delete button for each entry. On click of the delete button, it removes the current item, via:

 

Remove(collectionNameThisItem)

 

This should remove this entry from the collection.

 

What I have found is that if there are 3 entries (1,2,3), and I click the delete button on 3, entry 2 is removed.

 

Any ideas why this could occur?

1 ACCEPTED SOLUTION

Accepted Solutions
Sienna
Level 10

Re: Remove ThisItem Removes Different Entry

It is hard to say how exactly you should do it because you didn't tell us what collums your collection have but to do it propper you should have always a unique id collumn in your collection. There is few ways to generate unique id. I'm using Vaule(Now()) to create unique id in my collections. Once you got the id in your collection then use RemoveIf function.

 

Example if your button is outside the gallery

 

RemoveIf(CollectionName,ID=GalleryName!Selected!ID)

 

and if your button is within the gallery then

 

RemoveIf(CollectionName,ID=ThisItem!Selected!ID)

 

That way you will make sure the corect line is removed

View solution in original post

3 REPLIES 3
Sienna
Level 10

Re: Remove ThisItem Removes Different Entry

It is hard to say how exactly you should do it because you didn't tell us what collums your collection have but to do it propper you should have always a unique id collumn in your collection. There is few ways to generate unique id. I'm using Vaule(Now()) to create unique id in my collections. Once you got the id in your collection then use RemoveIf function.

 

Example if your button is outside the gallery

 

RemoveIf(CollectionName,ID=GalleryName!Selected!ID)

 

and if your button is within the gallery then

 

RemoveIf(CollectionName,ID=ThisItem!Selected!ID)

 

That way you will make sure the corect line is removed

View solution in original post

sparky13
Level: Powered On

Re: Remove ThisItem Removes Different Entry

My understanding of ThisItem, is that if I refer to ThisItem from within the gallery (an item in the galley), then I am referring to that row (assuming vertical layout).

 

Therefore, in executing Remove(col,ThisItem), this would remove that particular item (no matter what the values contained within).

Sienna
Level 10

Re: Remove ThisItem Removes Different Entry

No.. You need to specify exactly what line you want to remove.. If your collection would have exactly same values then it would remove everything

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 262 members 5,564 guests
Please welcome our newest community members: