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 / Patch Collection Value...
Power Apps
Answered

Patch Collection Value by Individual slider value within gallery

(1) ShareShare
ReportReport
Posted on by 112

Hi Power-Apps community,

 

I have another challenge I am not able to solve by myself and therefore kindly ask for your help.

 

Overall use case:

I am using the OOTB-Inventory App to track my inventory stocks. All of the displayed values in the App come from a SP List called 'Inventory List'.

I now want to improve the inventory App by a separate mobile App called QR-Code Scanner. Its goal is to easily update withdrawals or restockings of items.

 

Specific use case for the QR-Code Scanner:

 

Within my warehouse each product has a unique product code that is stored in a QR code. My users are to update the inventory list immediately whenever they are restocking or withdrawing items from the warehouse. To do that I have created a mobile App that uses the barcode-Scanner control to scan a QR codes. The QR code contains the unique product ID. By scanning the QR code this product ID is extracted and stored in a collection called Coll_multiscan. This collection, Coll_multiscan, is run against another collection called Coll_Products. Coll-Products is the Collection containing all of the data of the SP List 'Inventory List', to check for the ID and look up all the column details (e.g. name, current quantity) from the SP list. 

The scanned items are then displayed in a gallery, that does not only show the Product ID but also the name and the current quantity to add user friendliness. And now I run into the catch:

My goal is to make the App as user friendly as possible. The user is supposed to work with on hand only, no typing necessary. So this is why I want to introduce the slider. 

I have added sliders to the gallery items. There the user can either slide to the right to add the amount of items he has added or slide to the left to reduce the stock. I then want to patch these individual selections to the collection Coll_Products to update the quantities. 

To do that I use the following formula:

 

 

 

 

 

ForAll(RenameColumns(Filter(ProductCollect,ID in Coll_Multiscan.Barcode_Info),"ID","EID"),Patch(ProductCollect,LookUp( ProductCollect ,ID=EID),{'Curent Quantity':Slider5.Value}))

 

 

 

 

 

What happens then though is that not the individual slider values get passed but only the lastly selected slider value gets patched to all selected items. So if I have 2 items in the gallery and the individual selected values are

1. +4

2. -3,

 

-3 will be patched as all three quantities.

 

 Patch Problem.png

 

Anyone being able to help me?

 

Thank you and best regards

JHL 

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @JHL :

    Could you tell me :

    • Are the Slider controls in a gallery?
    • What is the gallery's Items property?
    • What is the relationship between the item in the gallery and the record to be updated?

    Firstly,let me explain why you encounted this problem.

    It is not feasible to directly reference the value of the controls in gallery. The correct way is to traverse the table Gallery.AllItems.For example:

     

    UpdateIf(
     ProductCollect,
     ID in Coll_Multiscan.Barcode_Info,
     {
     'Curent Quantity':LookUp(GalleryName.AllItems,Field1=field2).Slider5.Value
     }
    )

     

    I assume:

    • The name of the Gallery is "GalleryName"
    • The items in the Gallery and the records in ProductCollect are mapped through "field1" and "field2"

    If you have any problems,please feel free to let me know.

    Best Regards,

    Bof

     

     

  • JHL Profile Picture
    112 on at

    Hi @ 

     

    • Are the Slider controls in a gallery?
      • Yes they are supposed to be in the gallery.
      • This is important, as I want the user to the experiece that he scans the code, sees the item appear in the gallery and then instinctively reduces or increases the amount by the slider. The sliders are supposed to go along with the added items.
    • What is the gallery's Items property?
      • right now the gallery Items property is:
        Items= Filter(ProductCollect,ID in Coll_Multiscan.Barcode_Info)
      • The purpose is that I want to lookup my QR-Code 
    • What is the relationship between the item in the gallery and the record to be updated?
      • The relationship is that in the gallery items from my ProductCollect-Collection are displayed that are matching the Mulitscan.Barcode_Info. By selecting the slider I want the value of the slider be patched to the field 'Current Quantity' to replace the value within the collection. 

    Now I run into the following questions:

    • I am assuming that the formula you shared with is the OnSelect-property of my Submit-Button?
    • I am assuming that the fields 1 and 2 you are referring to are 'Current Quantity'?
    • Is it overall possible achieving what I am looking for by having the sliders be part of the gallery?

     

    Once again thank you bunches for your help in advance.

    BR

    JHL

     

     

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @JHL :

    I get it.

    Firstly,let answer your questions.

    • Q1:Yes.I'm taking about the OnSelect-property of your Submit-Button.
    • Q2:We can now skip this question, because I was not sure about your gallery settings before.
    • Q3:Yes.

    Secondly,here is my solution:

    1\Add a salder control into this gallery

    2\Set the submit-button's OnSelect property to

     

    ForAll(
     RenameColumns(GalleryName.AllItems,"ID","EID"), /*Traverse all items in the gallery (including silverer5)*/
     Patch(ProductCollect,LookUp( ProductCollect,ID=EID),{'Curent Quantity':Slider5.Value})
    )

     

    In addition,there is a simpler solution.

    Set the silder control's OnChange property to

     

    Patch(ProductCollect,ThisItem,{'Curent Quantity':Slider5.Value})

     

    In this way, you don't even need to submit changes. Once the value of silder is changed, the change will be automatically submited.

    Best Regards,

    Bof

  • JHL Profile Picture
    112 on at

    You @v-bofeng-msft  are the man. Thank you so much for your help on this one.

    One last question:

    If I wanted to substract the slider value from the 'Current Quantiy' how would you do this?

     

    Thank you and best regards

    JHL 

  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @JHL :

    Please try this code:

    ForAll(
    RenameColumns(GalleryName.AllItems,"ID","EID"), /*Traverse all items in the gallery (including silverer5)*/
    Patch(ProductCollect,LookUp( ProductCollect,ID=EID),{'Curent Quantity':'Curent Quantity'+Slider5.Value})
    )

    Best Regards,

    Bof

  • JHL Profile Picture
    112 on at

    @v-bofeng-msft:

    I appreciate your help so much!

     

    Have an awesome day💪💪💪💪

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
11manish Profile Picture

11manish 522

#2
WarrenBelz Profile Picture

WarrenBelz 437 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 405

Last 30 days Overall leaderboard