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 / Plus or Minus 1 for in...
Power Apps
Answered

Plus or Minus 1 for inventory

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Please note, I'm fairly new to PowerApps.

I am creating an app based on a list on our SharePoint site. Currently I have a Browse Screen to search through the inventory, a Detail Screen to view the item and how many are listed in stock, and an Edit Screen to edit the details of the item.  I would like to add a plus and minus button to the details screen so employees can add or remove an item from stock without having to into the edit screen.  I've looked into patch or update context but my problem seems to be getting the right info into the formula.  Perhaps I'm just not understanding which fields to pull in.  PowerApps has renamed what the fields are in my list to something else as far as I can tell. Here's a shot of my details screen.  Thoughts?  

Inventory App.JPG
Categories:
  • Verified answer
    timl Profile Picture
    37,409 Super User 2026 Season 2 on at

    Hi @Anonymous

    The Patch function expects 3 arguments: a data source, the record to update, and the data values to patch. The default edit form displays the record that's currently selected in the Browse Gallery on the initial screen (BrowseGallery1)  
    Therefore, the formula for your plus button would look something like this:

    Patch(SharePointListName,
     BrowseGallery1.Selected, 
     {InStockAmount: InStockAmount +1}
    )

    And the formula for your minus button would look something like this:

    Patch(SharePointListName,
     BrowseGallery1.Selected, 
     {InStockAmount: InStockAmount -1}
    )

    With PowerApps, we often refer to field names that look different to the underlying SharePoint field names, hence the Item_x0020__x0028_CIMs_x0029_x0 example that you cite. For example, x0028 and x0029 are the escape characters for open and close brackets. Therefore, we use x0028 in a field name instead of a bracket, so that we can still use parenthesis to enclose the arguments that we pass to a function in the formula bar.

    As a sidenote, the CDS data source now provides the ability to use the 'friendly' field names in formulas.

    https://powerapps.microsoft.com/en-us/blog/display-names-enters-preview-for-canvas-apps/

    Hope that's of some help to you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    thanks! that worked perfectly and I was able to adjust the code to use in a couple other areas 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard