cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
masterp
Helper I
Helper I

Barcode Scan Value to another Data Card

Hello Everyone, 

 

I very new to powerapps and hope this can be done very easily. 

 

I currently have a DataCardField called Vehicle VIN and item properties for this field is: 

Choices([@'Vehicle Mileage Report_1'].'Vehicle VIN')

 

This basically generates a drop-down field for users to enter from a selected list of VIN's.  I like this option but in addition, I would like to include the option for a user to scan the Vehicle VIN using their mobile device.  At this time, I incorporated the barcode scanner function but I would like for it to update the Vehicle VIN DataCardField with the scan results. Can this be done?

 

For BarcodeScanner1 onscan update datacardvalue with value without affecting the dropdown option.

 

Hope I'm explaining this correctly.

 

I would like this field to not only display 

2 REPLIES 2
JLincoln
Advocate I
Advocate I

Okay, so you want the value to be included in the dropdown and also be the default value.

Pull the value out of the barcode scanner using BarcodeScanner1.Value. This should be your VIN number.

The type of dropdown (Dropdown or Combo Box) you're using means this is going to be easy or a bit harder, but what you want is very possible, you'll just have to play around with how you name stuff until you get it right.

One way to do this is using Ungroup(), but you HAVE to have the column names the same. As you can probably tell, 'Vehicle VIN' is not the same as 'Value', so you either have to rename the BarcodeScanner1.Value into another column or rename Vehicle VIN; the latter is easier.

Another is to just collect the new VIN. This is... easier.

Whenever you want to grab the vin numbers, use this.
ClearCollect(
    colVINNumbers,
    RenameColumns(
        ShowColumns( [@'Vehicle Mileage Report_1'], "Vehicle VIN"),
        "Vehicle VIN",
        "Value"
    )
);

On the OnScan property of the barcode, put
Collect(
    colVINNumbers,
    BarcodeScanner1.Value
)

Now, what if your VIN number is duplicate? that wouldn't be very nice, would it.
For your choices, you're going to want distinct values, so your choices would be
Choices(Distinct(colVINNumbers).Result)

Now you want to set your default value (defaultselecteditems) to BarcodeScanner1.Value, but Result <> Value. That should be fine if you're using a dropdown, but if you're using a combobox then you'll have to manipulate BarcodeScanner1.Value into being a .Result form. You could go DefaultSelectedItems on the combo box to Distinct(BarcodeScanner1.Value).Result, and that's a bit hacky but it should work.

Uh... pretty sure that's all you need! If you have any more questions feel free to reply 😃

@JLincoln 

 

This sounds good but it's not what I am looking for and I probably didn't explain correctly.  Hope this helps explain my goal. 🙂

2020-10-12_13-14-49.png

VehicleVINDrop Down.png

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,492)