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 / For all items in gallery
Power Apps
Answered

For all items in gallery

(0) ShareShare
ReportReport
Posted on by 72

I have a powerapps inventory management that looks like this 

SamSellars_0-1665592185303.png

when the button is clicked I want all the values in the boxes to update a list that is connected to the PowerApps.

 

 

This is the code I have but It says there is a error with all of it. What have I done wrong?

 

ForAll(Gallery3.AllItems,
Patch(
'Merch Inventory'
First(
Filter(
'Merch Inventory',
Title = ThisItem.Title
)
),
{Quantity: ThisItem.Quantity - Amount}
));

Categories:
I have the same question (0)
  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at
    ForAll(Gallery3.AllItems,
    Patch('Merch Inventory',LookUp('Merch Inventory',Title = ThisItem.Title),
    {Quantity: ThisItem.Quantity - Amount}));

    Give this a go and please share a screenshot with underlined error if you still get an error

  • SamSellars Profile Picture
    72 on at

    SamSellars_0-1665593914114.png

    @Manan-Malhotra I get this error now

  • Verified answer
    Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on at

    ThisItem wont work outside of gallery, 

    Create a label inside gallery and use ThisITem.Title in it.

    Then in the code provided by me replace the ThisITem.Title with that Labelname.Text

     

    Do same with Thisitem.quantity

     

    Please Accept as Solution if it solves your question Or just give it a Thumbs Up if it is helpful because this can help others.

    LinkedIn: https://www.linkedin.com/in/manan-malhotra-vfx/

    Want to support me! Buy me a Cup of Coffee?

  • SamSellars Profile Picture
    72 on at

    Thanks that worked 

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @SamSellars 

    Just as an FYI...your ForAll is being used backwards!  

    You are trying to use it like a ForLoop in some development language - which PowerApps is not.  ForAll is a function that returns a table of records based on your iteration table and record schema.

    It is more efficient to use the function as intended and will provide better performance.

     

    Patch('Merch Inventory',
     ForAll(Gallery3.AllItems,
     {ID: ID,
     Quantity: Quantity - Amount
     }
     )
    )

    You will find the above to be highly performant as opposed to what you are trying.

    Also, since your Gallery already has the ID of the record to update, you don't need to "filter" the list over and over, just provide the ID for the record from the Gallery - patch will know what to do with it.

     

    I hope this is helpful for you.

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 396 Most Valuable Professional

#2
11manish Profile Picture

11manish 134 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 101 Super User 2026 Season 2

Last 30 days Overall leaderboard