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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch(), UpdateIf() fo...
Power Apps
Unanswered

Patch(), UpdateIf() for updating quantity in a Shopping Cart App?

(0) ShareShare
ReportReport
Posted on by 224

I have a collection called ShoppingCart with Product, Size, and Quantity.

 

How do I increase the quantity if someone adds the same size shirt?

 

Below is the code for the OnSelect button and is increasing the quantity correctly, but will create another record. How do I get it to just update the record?

 

UpdateIf(ShoppingCart, Product = DataGallery.Selected.Title && Size = SizeDropdown.Selected.Result, {Quantity: Quantity+1}); Collect(ShoppingCart, {Product: DataGallery.Selected.Title, Size: SizeDropdown.Selected.Result, Pics: DataGallery.Selected.Pics, Quantity: 1})

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @as733y 

    UpdateIf will not create a record, so there is something else going on in your app if you are seeing a new record created.

    I would utilize the monitor tool to start with and see what is going on at the point that you click the button.

     

    I hope this is helpful for you.

  • as733y Profile Picture
    224 on at

     

    @RandyHayes Below is the screenshot of the Monitor tool. I'm not entirely sure how to read this, but can you tell from this screenshot?

    as733y_2-1647542239237.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @as733y 

    So it looks like in that picture that you pressed on a button three times.

    The best thing to do is to prepare your app for that point in which you are just about to click the button, then go to the monitor tool and clear the data, then click on the button and see what actions it took.

    It does appear though that it is only one row that it is working with, but, since there are multiple actions in that photo, it is hard to tell.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard