
Announcements
Hi All,
I am not an expert of Power Apps, but I have tried in the last 3 hours to solve this issue watching tutorials or trying on my own, yet I was not able to make it, I would be super thankful to receive anybody's help.
My power app aims to record new inventory data details (ID, EAN...), and I simply want both my New and Edit form to capture a barcode value after scanning, and populating the input data field based on what has been scanned. Pretty simple - on the paper. But I am having quite the challenge.
In the past I used to do this very simply using this type of set-up:
To clarify in detail, I would set the parameter Default of my InputField (DataCardValue39) to the name of my barcode scanner followed by ".Value". Ex: BarcodeScannerMaterial_New.Value
Then I would place a different barcode per each different text input field needing it, and follow the same procedure.
It was pretty easy and worked fine, but after a couple years now I have a need to do the same and apparently the barcode has been updated. With this new configuration, I am finding it extremely difficult, especially because I have the following requirements:
- Not all SKU which will be scanned will have a barcode
- The SKU without a barcode, but with a SKU ID written somewhere on the box, will be manually input
- I need to force the input to be returned all in uppercase letters
- Therefore, I need to have the possibility of either inputting manually or scanning based on case
Now, I tried to use the Upper(), but it was not working.
Even if Power Apps did not flag any errors, when I submitted my form to sharepoint list, the item would be returned with lower case letters where these were used.
To solve this, I have set a variable following this logic:
- The data field text input for this example is called DataCardValue22
- The parameter default of this input field is set to a variable, "TextInputValueSKU"
- The parameter On Change is set to "UpdateContext({TextInputValueSKU: Upper(DataCardValue22.Text)})"
This allows me to digit anything I want, since however I write it, text will be automatically updated to uppercase as soon as I leave the field and/or move to a new part of the screen.
Now, my biggest challenge is to fit here the value scanned by the barcode.
How would you do this?
Below are some of the options I have tried:
- Create a custom data card at the bottom of the form, place a gallery (Gallery7) there for the barcode (BarcodeReader1), and setting visible to false
- Try to set the DataCard22 text value to mirror last selected item in this gallery, where "Label10" is the name of the item that in the gallery displays the value scanned by the barcode scanner
But I failed, as I think I was unable to code this properly.
Also, I tried to create a Variable following the logic below, but would not work I do not know why.
This variable is set on BarcodeReader1, parameter "On Scan". However, after scan nothing appears in the DataCardValue22.
"Set(SelectedRecord, Text(Last(Gallery7.AllItems).Label10, TextFormat.Text));
DataCardValue22.Text = Text(Gallery7.Selected.Label10, TextFormat.Text)"
In this case, I used the Text() function since datacardvalue22.text needed a text to be returned/matched, otherwise an error would be flagged due to incompatibility of data types.
Anybody can help me? My head is fuming and I never studied coding - I am quite confused!
Thank you in advance,
Carlo