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 / I want to decrement a ...
Power Apps
Unanswered

I want to decrement a value of my Sharepoint list

(0) ShareShare
ReportReport
Posted on by 29

Hello, I have a sharepoint list in which a Admin can add the amount of PC's in stock. On a new page, a engineer can click which PC he removed for installation. Now I want to decrement the number of PC's in my list when the engineer clicks on the Button "Removed from stock"

Categories:
I have the same question (0)
  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    So you have a Removed from Stock column, ritght? Is it a Yes/no Column?

     

    You should be able to count the rows where Removed from Stock is different from No.

     

    Another solution would be to have a label with current stock and another that takes 1 from the number in current stock and then patch that column to the source to update current stock.

     

    Note: Watch out for delegation.

  • v-qiaqi@microsoft.com Profile Picture
    on at

    Hi @FabianPowerAppM,

    Could you please tell me if you something edit grid for you to display/edit data?

    Do you want to update the stock quantity once the user clicks the remove button?

     

    I would suggest you add a Gallery or combine a Gallery with an edit form, whatever.

    If you have a Gallery display all the data, I would suggest you insert the remove button and set the OnSelect as below:

    Patch(List,ThisItem,{Stock:Value(ThisItem.Stock)-1})

     

    Just give more details if the above could not solve your problem.

  • FabianPowerAppM Profile Picture
    29 on at

    I think its the best when I explain it with pictures:

    FabianPowerAppM_0-1656916496566.png

    Here the technican can choose what he wants to pick from the stock. After he clicks "Next" this page appear: 

    FabianPowerAppM_1-1656916615427.png

    Here he can see the amount and the Item. When he clicks on the button bottom right the amount should subtracted from the amount in the sharepoint list which is here: 

    FabianPowerAppM_2-1656916692473.png

     

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    Hi,

     

    This will do what you want.

     

    For 1 record:

    Patch ( YourTable, YourGallery.Selected, { Lagerbestand: YourGallery.Selected.Lagerbestand- Value(Menge.Text) })

     

    For all records in the gallery at once:

    ForAll(
    YourGallery.AllItems,
    Patch ( YourTable, ThisRecord, { Lagerbestand: ThisRecord.Lagerbestand- Value(Menge.Text) })
    )

  • FabianPowerAppM Profile Picture
    29 on at

    I am a really beginner in PowerApps, can you explain what you mean with Records in Gallery ? 😄

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    A gallery is a list of records... I assumed you are using a gallery for the list of Artikels, so placing the above code in Weiter should do what you need

     

    ForAll(
    YourGallery.AllItems,
    Patch ( YourTable, ThisRecord, { Lagerbestand: ThisRecord.Lagerbestand- Value(Menge.Text) })
    )

  • FabianPowerAppM Profile Picture
    29 on at

    We are on a good way but somehow he dont find my "Lagerbestand" in the Patch. Look:

    FabianPowerAppM_0-1657007910728.png

     

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    Hi,

     

    What's in Gallery5_1 Items?

  • FabianPowerAppM Profile Picture
    29 on at

    FabianPowerAppM_0-1657011805692.png

    "Auswahl" but IDK what this means. When you click inside the Combobox on a item this happens: 

    FabianPowerAppM_1-1657011885019.png

    and after clicking add, it appears inside the gallery

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    That must be a collection

     

    Try this:

    ForAll(
    YourGallery.AllItems,
    Patch ( YourTable, Lookup( YourTable, Artikelnummer = ThisRecord.Artikelnummer), { Lagerbestand: ThisRecord.Lagerbestand- Value(Menge.Text) })
    )

     

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 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard