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 / Patching with some cal...
Power Apps
Answered

Patching with some calculations

(0) ShareShare
ReportReport
Posted on by 69

Hello PowerApps Community,
I'm building a sort of online shopping cart.

My data source: A SharePoint List that has the item name, details, and quantity

Interface: I'm using PowerApps with a button that patches all items in a collections to a few SharePoint Lists. 
I have a collection "colMyOrder' that collects items users want to check out.
There is a "Quantity" text box where the user can add the items they like
There is an "Inventory" field on SharePoint that has the current number of available items

Question: In the SharePoint List, there is a field that has quantity available. When the "Check Out" button is clicked, I would like the "Inventory" field in SharePoint to be automatically reduced by the "Quantity" text box input. I assume that this would be done with a patch functionality.

What I have thus far:
ForAll(
colMyOrder,
Patch(
'Company Store',
{
Inventory0: Value(CurrentInventory.Text) - Qty
}
));

^ With this code, when the "Check Out" button is selected, a new row is created to SharePoint with the Updated Quantity (Qty) instead of pending to the current SharePoint field.

* colMyOrder = my collection
*Company Store = the name of my SharePoint List
*Inventory = name of my SharePoint List Column
*CurrentInventory = a Label on my gallery that has the current Available Inventory

Thanks much!

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at
    @axt3641
    I think this section of your code must be changed.

    Patch(
    'Company Store',
    {
    Inventory0: Value(CurrentInventory.Text) - Qty
    }

    LookUp requires 3 arguments. The 2nd argument was missing in your code. It tells the PATCH function which specific record should be updated.

    Patch(
    'Company Store',
    LookUp(‘Company Store’s,ID=your_inventory_id),
    {
    Inventory: Value(CurrentInventory.Text) - Qty
    }

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • dyee4614 Profile Picture
    283 on at

    wrong thread.

  • axt3641 Profile Picture
    69 on at

    Thanks MrDevaney!
    Works. I just had to add the which items to patch like you mentioned. Appreciate the 2 cents, sir.

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 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard