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 / Adding a + and - butto...
Power Apps
Unanswered

Adding a + and - button to a gallery per item

(0) ShareShare
ReportReport
Posted on by 46

Hi all,

 

I am trying to create a shopping cart for my office merchandise. I would like to add a plus and minus button to the gallery of items that are pulled from a SharePoint list. 

EitanKGCS_0-1648134465487.png

Once someone has selected the quantity, I would like it to be saved to a collection that is the basket which they can then make an order for the total items selected. I have managed to create a collection for the basket but the last part I am stuck on is getting plus and minus buttons to work. I don't want to connect it to a SharePoint list until the order has been confirmed and sent to processing so would prefer if this was a collection but UpdateContext doesn't work and can't seem to work out the exact formula for a collection. 

 

Does anyone have any suggestions?

 

Thanks,

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @EitanKGCS 

    For your Plus/Increase icon OnSelect:

       Update(yourCollection, ThisItem, {Qty: ThisItem.Qty + 1})

     

    For your Minus/Decrease icon OnSelect:

       Update(yourCollection, ThisItem, {Qty: ThisItem.Qty - 1})

     

    I hope this is helpful for you.

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Haha I was too slow

  • EitanKGCS Profile Picture
    46 on at

    Thanks for the quick response. 

     

    Update(colShoppingCart,ThisItem,{QTY:ThisItem.QTY+1})

     

    I have added this to my plus icon and the error showing up is "Name isn't valid. this Identifier isn't recognized."

     

    I haven't added a coded default figure into the text input, it is just a 0 at the moment. What should I put in the default section there as well?

     

    Do you know what could be causing this?

     

    Thanks,

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

    @EitanKGCS 

    What part of the formula is showing as not recognized? Click into the formula and hover over the red underlines.  Look for a thicker/darker red underline to pinpoint the area of the formula that it is complaining about.

  • EitanKGCS Profile Picture
    46 on at

    @RandyHayes 

     

    "ThisItem" is invalid.

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

    @EitanKGCS 

    Then the formula is not in your Gallery!!  Where are you putting this formula?

  • EitanKGCS Profile Picture
    46 on at

    I am putting it in the Plus button. Should I be putting it in the items section of the gallery? Because the items are being pulled from a SP list so I wanted to keep them separate.

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

    @EitanKGCS 

    No, this should be on the OnSelect action of your control that is IN the gallery template.  Not outside of it.

  • EitanKGCS Profile Picture
    46 on at

    Yes, that is what I have done. The button is definitely in my gallery and has been copied to every item in the gallery as well. For some reason, it just doesn't seem to like ThisItem.

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

    @EitanKGCS 

    Can you provide a screenshot of your gallery with the left control tree expanded?

    I am not sure what you mean by "copied to every item in the gallery".

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 955

#2
11manish Profile Picture

11manish 652

#3
Valantis Profile Picture

Valantis 626

Last 30 days Overall leaderboard