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.
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).
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.
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.
Best Regards,
Allen
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
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.