Skip to main content

Notifications

Community site session details

Community site session details

Session Id : ncb7/wEnbr8s2BIwArc0RQ
Power Apps - Building Power Apps
Answered

Remove Item from Gallery of Collection

Like (0) ShareShare
ReportReport
Posted on 22 Jul 2020 14:50:57 by

Hello,

I have a collection called 'collChallenges' and I have a gallery that displays the collection called 'ChallNewCollectionGallery'. I'm trying to give users a method of removing Challenges one at a time. I have tried two methods, neither of which is working properly. The trashcan method does sometimes allow for the removal of the first Challenge but no others. Here are screenshots of the two attempts:

rockmond_0-1595429316126.png

and

rockmond_1-1595429401992.png

Any explanation and help on why this is not working and how to fix it would be greatly appreciated.

 

 

  • CALEBHOWARD80 Profile Picture
    25 on 03 Jun 2024 at 19:31:52
    Re: Remove Item from Gallery of Collection

    This is way simple if you are inside the Gallery.

     

    Remove(DS,ThisItem
  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    on 23 Jul 2020 at 06:39:38
    Re: Remove Item from Gallery of Collection

    Hi@rockmond,

    Based on the issue that you mentioned, do you want to remove the item from the gallery or the collection?

    The first formula you provided only remove the item from the gallery that won't remove item from the collection. If you want to remove a item from the gallery and the same to the collection, you should make sure to find the primary key in your data source.

    I tested the Remove() function seems that there is something wrong when working with the Gallery.Selected record. Please modify the formula as below

     

    Remove(collChallenges,LookUp(collChallenges,ID=ChallNewCollectionGallery.Selected.ID))

     

    Note: ID is a normal primary key in the data source, you can replace it with yours in the collChallenges.

    Best Regards,

    Qi

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on 22 Jul 2020 at 15:06:47
    Re: Remove Item from Gallery of Collection

    Hi @Anonymous 

    The problem may be related to the use of a collection as the Items property of the gallery.  The trashcan in the row will remove it from the collection but not the underlying datasource used to create the collection.  Unless the item is removed from the datasource, when a ClearCollect is done to refresh the gallery's collection, the item will reappear. If you want the item removed from the datasource and the collection you need to remove it and then refresh the collection, ie. for the OnSelect property of the trashcan icon

     

    Remove(ds,ID=ThisItem.ID); 
    ClearCollect(collection,ds)

     

    for the button outside the gallery:

    Remove(ds,ID=Gallery.Selected.ID); 
    ClearCollect(collection,ds)

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,011 Most Valuable Professional

Leaderboard
Loading started