Hello community.
Looking for some help here:
I am currently creating an app to scan QR codes. The QR code generated data is from a HTML Label, and basically is a string with the values of the selected record plus & Char(10) in between each field.
ie = BrowseGallery1.Selected.Title & Char(10) "& BrowseGallery1.Selected.ID & char(10) ............etc.
I am getting the QR code with no issues. Now what I need to know is once the QR code is scanned I need to split that value or string to save each value in a Share point. Something like to break that line of text, create a collection and save each scanned code into a new row in my Share point list.
Somebody could please point me in the right direction?
Many thanks
Hey @lcimon , A big thank you !!!!!
A little bit complicated but finally is working great. Thank you thank you thank you
🙂
You can achieve this using the Left & Right function to get only the part you need.
An alternative would be to not include the part you don't need in the barcode like:
HtmlText = varRecord.MID & Char(10) & varRecord.Title & Char(10) & DataCardValue2 & Char(10)
& varRecord.Employee
Please consider to click on Accept as solution if my post help you to solve your issue.
Yeaaahhhh. Finally the light at the end.
I got the 4 fields divided which is great. Just one minor thing and I guess I have to figure out. Because in my QR Code it shows for instance:
ID: 00000-27
25 EA
Operator: JK
I need to remove using the substitute function to only get:
00000-27
25
JK
Other than that your solution is great!
Sorry I missed the other fields, here the updated formulas:
Label1 = First(Split(ThisItem.Barcodeinfo, Char(10))).Result
Label2 = Last(FirstN(Split(ThisItem.Barcodeinfo, Char(10)), 3)).Result
Label3 = Last(FirstN(Split(ThisItem.Barcodeinfo, Char(10)), 4)).Result
Label4 = Last(FirstN(Split(ThisItem.Barcodeinfo, Char(10)), 2)).Result
(I might mixed up the labels)
Basically, Split(ThisItem.Barcodeinfo, Char(10)) will split each part of your barcode into an array (based on the Char(10) as delimiter).
Then, we have to get the right item at the right place. As PowerApps didn't provide a way to get an item by index, we need to use this workaround with Last and FirstN formulas. By example, for the 3d element:
Hope it will help
Hey @lcimon ,thanks again for your help. Yes I need to split that Barcode string but where I am getting mental is because I need to split into 4 different pieces.
Label1 = MID
Label2 = Title
Label3 = DataCardValue2
Label4 = Employee
I was able to get the Label1 and Label 4. But nothing for the values in the middle.
Thanks for the clarification.
So If I well understand, once a barcode is scanned, it is added into a Gallery where you want to split its content in 2 separate labels.
A simple solution could be the following:
Label1 = First(Split(ThisItem.Barcodeinfo, Char(10))).Result
Label2 = Last(FirstN(Split(ThisItem.Barcode, Char(10)), 2)).Result
Your patch formula seems to be correct and compatible with these formulas.
the issue could be maybe because here I am using Char(10) instead of <br>?
HtmlText =
varRecord.MID& Char(10)&"ID: " &varRecord.Title & Char(10)&DataCardValue2&" Lbs" & Char(10) &"CreatedBy: " &varRecord.Employee
Ok, Sorry for the mess.
First thing first:
The parameters for my QR Code are like this:
HtmlText =
varRecord.MID& Char(10)&"ID: " &varRecord.Title & Char(10)&DataCardValue2&" Lbs" & Char(10) &"CreatedBy: " &varRecord.Employee
This value is placed at the end of my Image property like this:
"https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl="&QRdata
That is how is generated the QR Code.
Now to read the QR Code I have my app
Button Scan
On Scan = Collect(collectMultiScan, {Barcodeinfo: BarcodeScanner.Value})
I have a Gallery =
Item = CollectMultiscan
In my Gallery I have 2 labels so far trying to split the QR Code Code
Label1 = Left(ThisItem.Barcodeinfo, Find(" ", ThisItem.Barcodeinfo)-1)
Label2 = Right(ThisItem.Barcodeinfo, Find("CreatedBy:", ThisItem.Barcodeinfo)+2)
And I have a button to patch my gallery
Submit =
ForAll(collectMultiScan, Patch(TallySheet, Defaults(TallySheet),{Title:Label1.Text, Operator:Label2.Text}));Clear(collectMultiScan)
This is what I have. I just need to patch my SPL "TallySheet" with all the values in my gallery matching Title = Title, Operator = Operator.
Make sense?
Sorry again
I'm in trouble to understand what you want to achieve. Could you please elaborate a bit, please ?
Hey, Thank you very much for the prompt response.
However I have a small issue.
For my OnScan property I have the following:
Collect(collectMultiScan, {Barcodeinfo: BarcodeScanner.Value})
In my gallery I was able to get the first line but with some issue doing this:
Left(ThisItem.Barcodeinfo, Find(" ", ThisItem.Barcodeinfo)-1)
But I guess still wrong.
And after apply your formula I am getting error: expected a text value
WarrenBelz
146,522
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,890
Most Valuable Professional