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 / Subtract input value f...
Power Apps
Unanswered

Subtract input value from stock quantity

(0) ShareShare
ReportReport
Posted on by

Hello Community,

 

I have a Stock Management app in place that keeps stock of multiple assets.

SharePoint Database List:

FilipC2_0-1669040070963.png

In the app I have a form were user input data and stores this data in a collection displayed in a gallery so that if needed user will be able to submit multiple lines at one time.

FilipC2_1-1669040312235.png

OnSelect of submit button at this moment:

ForAll(vAssetHO, UpdateIf('Asset Management', Model = Dropdown1.Selected.Result, {Quantity: Quantity - Value(DataCardValue6.Text)}))

 

I am not receiving any errors in the formula but the stock quantity it is not getting updated (subtract input quantity).

 

Would appreciate any help!

Thank you in advance for your support!

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @FilipC2 

     

    How about you just keep the code like this? I think it's sufficient enough.

    UpdateIf('Asset Management', Model = Dropdown1.Selected.Result, {Quantity: Quantity - Value(DataCardValue6.Text)})

     

    May I know if you are trying to update all these in your gallery in one go? 

    What was your goal for the ForAll function in your code?

  • FilipC2 Profile Picture
    on at

    Hello @cha_cha,

    Thank you for your quick reply,

     

    This does not work either ...

    I have figured another mistake that I was making. When I was submitting form to save data into collection, Form was also resetting, and my initial formula was wrong because Value(DataCardValue6.Text), was Form data card that was resetting. So my new formula that is mentioning data stored in collection isy

     ForAll(vAssetHO, UpdateIf('Asset Management', Title = Label_HOAsset.Text && Model = Label_HOModel.Text, {Quantity: Quantity - Value(Label_HOQuantity.Text)}))

    But this is stil not updating database Qty ... 

  • FilipC2 Profile Picture
    on at

    Strange is that when I highlight Value(Label_HOQuantity.Text) it is saying that it is blank, but this label has value '1'  in it...

    FilipC2_0-1669045951059.png

    And same for the other label Value(Label_Quantity.Text)

     

  • cha_cha Profile Picture
    4,932 Moderator on at

    Hi @FilipC2 

     

    May I know why you are using the ForAll function in your code? I want to know to try to understand how you are building up your code. Because based on your screenshots, and the codes you have shared, I see that there is no need for the ForAll to be added since already has the UpdateIf function.

     

    Another code suggestion would be to use Patch, but I still doubt it will work since I have a limited view of what your structure is.

    Patch('Asset Management', Model = Dropdown1.Selected.Result, {Quantity: Quantity - Value(DataCardValue6.Text)})

     

  • FilipC2 Profile Picture
    on at

    I am using ForAll because I have to submit the changes (calculated stock) from a collection like ForAll collection item update stock.

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard