Skip to main content
Community site session details

Community site session details

Session Id : vafZqrJkHWVCMZL4Pfmh+p
Power Apps - Building Power Apps
Answered

Update a collection item number

Like (0) ShareShare
ReportReport
Posted on 12 Aug 2020 07:31:23 by

Hi,
I'm working on an inventory app and i need to be able to add and remove items from a  collection as they're selected from a gallery. I'm getting stuck on updating a record in a collection, which in my scenario is the quantity of items selected from the gallery.

Users should be able to click on the same items multiple times and those items will be added to the collection and needs to show the latest item number, as shown below. How can I update just one row in a collection when clicked a button. 


First is the gallery which has the items of our inventory. I want to add one to my cart.

collect1.PNG

The item is added in my cart and now there is 36 left in the inventory

collect2.PNG

 

I have added an extra item of the same to my cart, which tells me there is now 35 left in our inventory

collect3.PNG

 

But can I get the amount of inventory in the previous added item to change to 35? 

collect4.PNG

  • Verified answer
    Community Power Platform Member Profile Picture
    on 18 Aug 2020 at 08:10:05
    Re: Update a collection item number

    Solved it with 

    Collect(Cart, {HardwareType:ItemOverview.Selected.HardwareType, Amount:Subtitle1.Text -1}); Patch(Stock,ItemOverview.Selected,{Amount:ThisItem.Amount-1});

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on 13 Aug 2020 at 17:08:48
    Re: Update a collection item number

    What if you try to add to your 'Add' icon'.OnSelect existing code:

     

    // your existing code here first;

    ForAll(Filter(Cart, HardwareType = ItemOverview.Selected.HardwareType),
        Patch(Cart, ThisRecord, {Amount: ItemOverview.Selected.Subtitle1.Text -1})
    );

     

     

     

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete