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 / Increment within a Gal...
Power Apps
Suggested Answer

Increment within a Gallery

(0) ShareShare
ReportReport
Posted on by 155
I'm not seeing how this is possible.  I've been asked to add an input to a gallery that allows a user to add/subtract incremental values for each record.
 
So, each record in the gallery should have a control such as:
 
Where clicking the up arrow would increase the value by 0.01 and the down error would decrease by 0.01.
 
Using a global variable won't work as each record in the gallery will have such a control.  Updating one record will update all when using a global variable. 
 
I'd rather not patch back to the data source with each button click.
 
Appreciate any advice.
 
 
Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,725 Most Valuable Professional on at
    Have you tried building a custom component with the two arrows and the textbox.  A global variable inside the component wouldn't be visible to the app. That way you could isolate everything except the default value (input) and the final value (output).  I haven't tried adding a component to a gallery, but that would be what I would try.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
     
  • Apurva Profile Picture
    91 on at
    Hello, I have created similar functionality for a different use case. You can find it here https://youtu.be/LThBCfJ5jxM?si=6cnbUGIqkNh0U1Gw
     
    Try this and please let me know if it helps! 
  • Suggested answer
    Gabriel G. Profile Picture
    831 Super User 2025 Season 2 on at
    Your global variable can’t deal with many items in a gallery using the same variables. As an alternative, you can add a column to your gallery collection to record your custom value: 
     
    AddColumns(<galleryCollection>, newColumnToIncrement, 0).
     
    Then, you will create a textbox, which will display the value ‘ThisItem.newColumnToIncrement’. You will also create 2 buttons to increment or decrement that value using your brand new column ‘ThisItem.newColumnToIncrement’:
     
    incrementButton.OnSelect(Patch(<galleryCollection>, ThisItem, {newColumnToIncrement: ThisItem.newColumnToImcrement + 1}))
     
    You can do it the same way for the ‘-‘ button but with - 1 instead.
     
    I hope it resolves your need!
     
    _____________
     
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!
  • Suggested answer
    jrletner Profile Picture
    720 Super User 2025 Season 2 on at
    If you loaded your gallery into a collection, you'd have the scope necessary to increment each one in a gallery.
     
    The arrows patch the new value by .01 either up or down.
     
    Up arrow:   Patch(colUsers,ThisItem,{Rank: ThisItem.Rank + .01})
     
    Down arrow: Patch(colUsers,ThisItem,{Rank: ThisItem.Rank - .01})
     
    Then you could patch your datasource from the collection somewhere in your code.
     
     
     
     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard