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 / Item Counter for Speci...
Power Apps
Answered

Item Counter for Specific Row in Gallery

(0) ShareShare
ReportReport
Posted on by 35

Hi everyone,

 

I have made some pretty great strides since I last posted a very vague, "what the heck am I doing", post weeks ago.

 

What I am trying to achieve with this particular problem is displaying a quantity to a specific product on its respective row in the gallery.

 

I a collection that records details of selected products available in a gallery. The text label that the arrow points to in my screenshot contains the variable in my formula bar. This variable counts the rows that contain the product name of the last selected product in the gallery. I would like to change this from the last selected item, to the specific product that aligns with the row in the gallery.

 

So when I click the plus button on the first row for product "1", my quantity should increase by 1 for that product. When I click the plus button the second row for product "2", the quantity for product "1" should remain the same, while the quantity for product "2" reflects the current quantity for that product.

 

What is happening currently, with the way I have the formula built, the quantity in the text label updates based on whatever the last item selected is. So, say I add product "1" to my shopping cart. All of the text labels in the gallery increase and show the count for that specific product. When I then go and add product "2", all of the text labels change to reflect the count of that selected item. 

 

 

TitanicTips23_0-1698250512398.png

 

 

Any feedback is greatly appreciated!

Categories:
I have the same question (0)
  • frauke_h Profile Picture
    4 on at

    I think you can set the Item Property of the Gallery to an Collection with a Column "Quantity" (Default = 0) and the property "On Select" of the "+" Icon, you can Patch the Quantity to ThisItem.Quantity + 1. 

    E. g.
    [Gallery] Item = colProducts 
    [IconAdd] OnSelect = Patch(colProducts, LookUp(colProducts, ID = ThisItem.ID), {Quantity: ThisItem.Quantity + 1})

     

    If there are any other options or questions please let me know.

  • Verified answer
    crispybits1977 Profile Picture
    195 on at

    I'm just guessing, but would I be right that the label at the end that displays the count is set to "varGlobalItemQuantity"?

     

    That's the only reason I can think of why it's behaving in this way, and to fix it if it is that I wouldn't bother with that variable at all, and set the label at the end of each line to just the code you're using for that variable, so:

     

    CountRows(Filter(colShoppingBasket, Product = ThisItem.Title))

     

    I think what;s happening now is every time someone clicks any + sign you set that variable, and where you have all the labels set to that variable instead of looking up their value independently that's why they're all changing. At the very least should be a quick one to test and see if it works out?

  • TitanicTips23 Profile Picture
    35 on at

    This accomplished what I was looking to achieve. Thank you!

     

     

    This appears to work well for the gallery on the current page, but I do want to be able to take this value and display it on a review page. I'll see how things shake out when I get there, but for now, you have solved my problem!

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