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.
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 😃