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 / Best practice for Upda...
Power Apps
Answered

Best practice for Update a Collection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi Everyone,

 

I have a Barcode scanning tool that I have created. 

Prior to scanning, users must select the "Type of Scan", it's a drop down. Let's say it's either A or B.

The user selects Type A.  

The user starts to scan, and as the Barcode scan is collected. The Type of Scan is collected. 

Ex. The first Barcode item: 123 , TypeOfScan: A 

Now, if the user changes the Type to B.

The first barcode is still Type of Scan A.

 

What is the best practice, to update the whole collection to what the Type of Scan is currently selected as? 

 

Thank you,

Categories:
I have the same question (0)
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Are you using Collect or Patch to add your bar code to the collection?

     

    If you use Patch, you can patch the bar code and the scan type to the collection.   Based on your comment I am going to guess that you are using a gallery?

     

    Patch(CollectionName, ThisItem, {BarCode: barcodecontroldata, ScanType: scantypedata}

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @JR-BejeweledOne 

     

    My app is a bit more complicated so I am using Collect as there are variations in the key in the barcode/item information. 

     

    Are you saying that if I use Patch, and change the Type of Scan, it would update historical information as well? 

     

    If that's true, then would I be able to use both Collect and Patch (just for the type of scan drop down) for each item? 

     

     

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Let's clarify this a little to make sure I understand what is happening.

     

    Your user selects a scan type and then scans the barcode, but then goes back and changes the scan type to a different one, and you now need to update the scan type for the barcode that was just collected?

     

    Do I have that right?

    What happens after the barcode is collected?   Can they scan another one or do they need to submit the first one that was scanned?

  • dyee4614 Profile Picture
    283 on at

    You can do something like UpdateIf(ColScanData,TypeOfScan=!dropdown.selected.value,dropdown.selected.value)

    dropdown selected value = type of scan field

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

    Hi @Anonymous ,

    Do you want to change all items' type in the collection to the currently selected type? Or just change the type of the current item?

    If the former, please try this:

    UpdateIf(CollectionName, true,{ScanType:DropdownName.Selected.Value}

    If the latter, please try this:

    Patch(CollectionName,Last(CollectionName),{ScanType:DropdownName.Selected.Value})

     Hope this helps.

    Sik

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
WarrenBelz Profile Picture

WarrenBelz 429 Most Valuable Professional

#2
11manish Profile Picture

11manish 191 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 122 Super User 2026 Season 2

Last 30 days Overall leaderboard