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
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 😃
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. 🙂
User | Count |
---|---|
258 | |
110 | |
90 | |
52 | |
44 |