cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sparky13
Frequent Visitor

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
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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
Frequent Visitor

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
Memorable Member
Memorable Member

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (4,118)