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 / Increment number with ...
Power Apps
Answered

Increment number with button, in a Gallery

(0) ShareShare
ReportReport
Posted on by 24

I am building a shopping cart in a Gallery. I pull the description of the product from a collection to populate the Gallery control. I have a text input field so a user can type in a qty. I also added two buttons with plus symbol and minus symbol so a user can just tape the button to Increment the order quantity. I tried using the solution down below but it's updating every item in my collection. Example, if I tape the plus symbol button twice every item shows ordering two. What am I missing?

 

 

Use this code in the OnSelect property of your button.

 

Set(myPurchaseOrderNum, Value(TextInput1.Text) + 1);
Set(myPurchaseOrderReset, true);
Set(myPurchaseOrderReset, false);

Put this code in the Default property of your text input.

 

myPurchaseOrderNum

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @RogerHar 

    Put  ">" and "<" Icons inside the gallery to increment and decrement the Default property of TextInput box tied to the Quantity field.  Have the OnSelect property of the ">" icon as  

     

    Patch(
     yourcollection,
     ThisItem,
     {quantity: quantity + 1}
     )
    

     

     for the "<" icon have the patch argument as quantity:quantity-1.  The important take away is that you need to have the icons inside of the gallery and have them patch the current record.  Otherwise you will get the result you showed above.  A more elegant way to do it is to put a slider inside the gallery and set the Default of the TextInput box to the Slider.Value as in the screenshot._1.png

  • RogerHar Profile Picture
    24 on at

    Finally wrapped my head around how it works. Thank 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
11manish Profile Picture

11manish 402 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 296 Most Valuable Professional

Last 30 days Overall leaderboard