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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Subtracting Two Values...
Power Apps
Unanswered

Subtracting Two Values and Updating Sharepoint List Column

(1) ShareShare
ReportReport
Posted on by 2

I have about 15 hours into the app I am creating for work and 13 of those are trying to figure this out.

 

Basically, my app tracks tool inventory at my job. Put in your email address on the welcome screen and the start shopping button appears. It then navigates to a browsegallery that gets its info from a SharePoint list. When you select and item, it goes to a detail page to show a pic of the item, how many are on hand, and other pertinent info. Once selecting the shopping cart button, it sends the item to both a collection called ShoppingCart and another screen that shows all items you placed in the shopping cart. 

 

Once you are done shopping, you click the order button and it creates another collection called Too Receipt List in SP and writes the info I want a record of. It sends an email of the items to the person that originally put their email on the welcome screen and navigates to a success screen and after a five second timer, returns to welcome screen.

 

All of that works perfectly. What I cannot figure out is how to patch, update, forall, first, filter, and every other command you can think of to perform a simple subtraction of "1" from all items in the Gallery on the shopping cart page, to that record on the main SharePoint tool list. I say "1" because I we only give out one of each tool to the employees so no need to have it do any more. 

 

Here is what I have and I have modified this so many times, I know it is wrong but may clue someone in as to what I am doing wrong. Oh, and at one time in hours I have researched this issue, I was able to see it deduct one time from only one record even though there were multiple in the shopping cart. Don't remember what I used to do that now.

 

ForAll(Gallery1.AllItems, Patch('Tool List for App', {ItemQuantitySP: Value(ItemsOnHand.Text) - Value(Slider1.Value)}));

 

Slider1 is a hidden slider that is defaulted to only have a value of "1". I have also done this without the value(slider1.value) and just had "-1".

Also did this without the "forall", tried with "lookup", you name it. My brain is fried with what will most likely be a super fix.

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    on at

    @rlbstein 

    You need to let the Patch statement know which record to adjust, currently you are not doing that. You can use 'As' or 'ThisRecord' to do this. If ItemsOnHand is a field in your 'Tool List for App' then you can do this:

     

    ForAll(
     Gallery1.AllItems, 
     Patch(
     'Tool List for App',
     ThisRecord,
     {ItemQuantitySP: ThisRecord.ItemsOnHand - 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard