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 / Plus and Minus Buttons...
Power Apps
Answered

Plus and Minus Buttons in a Gallery

(0) ShareShare
ReportReport
Posted on by

Hello, I am relatively new to Power Appa but am learning quickly. I am currently working on an app for managing our first aid inventory. I have a share point list (Inventory) where the columns include: Item, Expiration, QTY and PAR. 

I have built a Gallery with the data from share point and have added 2 buttons, a plus and minus. I can get the buttons to add or subtract from the QTY by using Patch() but this is oftentimes slow to change the number in the app. 

I am looking for a way to have the buttons add or subtract from the QTY number and then update the Share Point List once another button Confirm Changes) is clicked. I have toyed around with collect() but cannot get it to work. 

Any help is greatly appreciated. 

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

    Hi @Anonymous

     

    We can use the collection to store the changes and update SharePoint when Confirm button is clicked. For example, an item will be added to the collection when you update row 2 in the gallery. So your collection has only the items updated. And you are updating row 5 like wise

     

    In this case, We are updating Sharepoint only the items updated.

     

    Thanks,
    Stalin - Learn To Illuminate

     

  • Community Power Platform Member Profile Picture
    on at

    Thanks for the quick reply. I appreciate your time (and patience) with helping me. I am so close to completing this but have two obstacles:

     

    The below image is my current layout. I am having trouble Patching the data to a collection when you add or subtract using the +/- buttons. I essentially want to Patch(Collection,InventoryGallery.Selected, {QTY: ThisItem.QTY +1}, {QTYChange: ThisItem.QTYChange})

     

    The Quantity change (QTYChange) is defaulted to 0 and I have the white TextInput between the +/- buttons set to QTYChange so the user can see how many items they are adding or removing.

     

    Once the user adds and subtracts all of their items, I then want them to click the Preview Changes button which will Navigate() them to another gallery that is filtered to only show their changes. On this screen, it will give them the option to confirm their changes which will then initiate the Collection() patch() into sharepoint.

     

    The problem I am having is during the patch something goes wrong after the first successful patch and it will not work again.

    clbrown2_0-1644060843558.png

     

  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    I hope your patch statement might look similar to this

    ClearCollect(
     Collection2,
     RenameColumns(
     Collection1,
     "ID",
     "newID"
     )
    );
    
    ForAll(
     Collection2 As Source,
     Patch(
     SPList,
     LookUp(
     SPList,
     ID = newID
     ),
     {
     ColumnName: Source.ColumnName
     // All other Columns
     }
     )
    )

     

    Note. You may need to rename the column to avoid name conflict.

     

    Please share your code to assist more.


    Thanks,
    Stalin - Learn To Illuminate

     

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 739 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 268

Last 30 days Overall leaderboard