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 / Combobox Default Selec...
Power Apps
Answered

Combobox Default Selected Items Lookup Field

(0) ShareShare
ReportReport
Posted on by 7

Hey all, 

 

I have two CDS Entities:

 

Entity 1 is called 'Bins' and the primary field for that entity is 'Barcode_no'. So, each item in that list has a barcode number.

 

Entity 2 is called 'Shipment', it has a lookup field to 'Bins' where you can select multiple bins as being part of that shipment. 

So at this point, you are likely thinking : 'OK, so in the PowerApp, when the user is entering a new Shipment this will show up as a dropdown, and the user could select the multiple bins that are part of that shipment'

But of course, it get's a bit more complicated!

 

We do not want the user to select from a dropdown, we want the user to use the barcode scanner to physically scan each bin that is part of that shipment and then the app will check to make sure those numbers exist in the bin list and selects them automatically in the back-end. 


On the 'New Shipment' Screen, I created a collection that shows the barcode of the bins as they are scanned.

I'm unsure of the best way to go about having the app take that barcode data for each bin and patch to the multi-select lookup field.  I need to either:

 

A) Use a form in the app (which I'd prefer, though I'm flexible), update the lookup field's 'default selected items' with multiple items from the collection as they are scanned

 

Or

 

B) Patch the collection to the multi-select lookup field

 

Would be grateful if someone could give me a hand with this.

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @5by5carnivora ,

    Do you add a Multiple-Select LookUp field in your CDS Entity?

    Do you want to populate the LookUp field with multiple scanned 'Bins' with barcode value?

     

    Based on the scenario that you mentioned, I think you have some misunderstanding with the LookUp field in CDS Entity. The LooUp field is essentially a Many-to-One relationship in CDS.

    If you define a LookUp field in your 'Shipment' Entity, which reference Record value from your 'Bins'  Entity, the LookUp field could only reference single one record value from your 'Bins'  Entity rather than multiple ones.

    Please check the following article for more details:

    https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/types-of-fields#different-types-of-lookups

     

    # For your A direction, please set the DefaultSelectedItems property of the LookUp field ComboBox in your Edit form to follownig:

    LookUp(Bins, Barcode_no = BarcodeScanner1.Value)

     

    # For your B direction, please consider try the following Patch formula to submit new entry back to your 'Shipment' Entity:

    Patch(
     Shipment,
     Defaults(Shipment),
     {
     LookUpField: LookUp(Bins, Barcode_no = BarcodeScanner1.Value)
     }
    )

     

    Of course, if you want to patch each row in your Collection table as separated new entry in your 'Shipment' Entity, please try the following formula:

    ForAll(
     BarcodeCollection As LoopRecord,
     Patch(
     Shipment,
     Defaults(Shipment),
     {
     ...,
     LookUpField: LookUp(Bins, Barcode_no = LoopRecord.BarcodeValue),
     ...
     }
     )
    )

    Note: The BarcodeValue represents the column in your BarcodeCollection, which is used to store the scanned barcode value.

     

    Regards,

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 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard