web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Deleting collection it...
Power Apps
Answered

Deleting collection item in gallery

(0) ShareShare
ReportReport
Posted on by 407

I have a collection linked to gallery and created a delete confirmation box (Do you want to delete?, yes, no) I have the syntax on the Yes button. Everything seems to be working fine, however, if i have multiple items (for example, user1, user2, user3) and i try and delete user 2, it doesnt delete the selected it deletes user1. 

 

Remove(KBLCollection,LookUp(KBLCollection,UserID=CollectGallery_2.Selected.UserID));
SaveData(KBLCollection,"KBLCollectKeep");
UpdateContext({DeleteConfirm:false})

 

Can you please assist, any advice would be much apprectiated.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    Have you tried just doing Remove(CollectionName,ThisItem) if the control is within the context of the gallery item itself of course. So double check that the control is within the Gallery template.


  • Matt383 Profile Picture
    407 on at

    Hi Henry, yes i have tried Remove(KBLCollection,ThisItem) but had invalid argument, I tried Remove(KBLCollection,CollectGallery.Selected) no invalid arguments, but doesn't remove entry

  • Verified answer
    v-albai-msft Profile Picture
    on at

    Hi @Matt383 

    Do you want to add the "delete(Yes) button" beside each item or outside the gallery?

    I assume your button is outside the gallery as below, so please make sure if you have selected a record first inside your gallery and then click the delete button?(if your scenario likes below, to delete the second record, you should first select the second record in your gallery, then click delete button).

    v-albai-msft_0-1614133204038.png

    For troubleshooting your issue, you can add a label outside the gallery, set its Text property to “CollectGallery_2.Selected.UserID” to make sure which item now is selected.

    v-albai-msft_1-1614133204041.png

    I done a test on my side based on your description, everything works fine. You can check my steps:

    Add a label and two button outside the gallery(also rename them), and set the OnSelect property of “Yes” button to your formula:

    Remove(KBLCollection,LookUp(KBLCollection,UserID=CollectGallery_2.Selected.UserID))

    This time, by default, if you do not select any record in gallery first, CollectGallery_2.Selected.UserID points to the first record(so it will always delete the first record). If you want to delete user2, then you need to first click the user2 record in your gallery, then click “Yes” to delete user2.4.gif

    Best Regards,

    Allen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard