How do I get rid of extra space when scanning QR code?

2484
4
Jump to solution
07-30-2019 11:16 AM
JamesKelly4
Occasional Contributor

I have a barcode question on my survey that is a required field, and I have a regular expression that constrains it to a certain length. However, I have gotten a lot of complaints from the field that when they scan the barcode (actually a QR code) it adds a space to the end of the value it retrieved from the barcode. They have to manually delete the extra space before they can successfully submit their record. I am try to minimize data entry time as much as possible.  James Tedrick‌ do you know of a solution for this?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
IsmaelChivite
Esri Notable Contributor

You could try a calculation like this:

if(ends-with(${qrcode}," "),substr(${qrcode},0,string-length(${qrcode})-1),${qrcode})

Your QRCode question could be flagged to have an esriFieldType of null.

Then you would add a hidden question and add the calculation above.

If you do not want to change the geodatabase schema, then you can do the following:

Convert your barcode question into a hidden question and add the calculation above to it.

Add a new barcode question, set the label and all as you like and MAKE sure you have  it as esriFieldType null

View solution in original post

4 Replies
JamesKelly4
Occasional Contributor

If it helps, this is my regular expression: regex(., '^[1-5][1-2][0-9]\d{5}$')

0 Kudos
JamesKelly4
Occasional Contributor

Survey123 Geonet‌ got anything for me? Any help is greatly appreciated!

0 Kudos
IsmaelChivite
Esri Notable Contributor

You could try a calculation like this:

if(ends-with(${qrcode}," "),substr(${qrcode},0,string-length(${qrcode})-1),${qrcode})

Your QRCode question could be flagged to have an esriFieldType of null.

Then you would add a hidden question and add the calculation above.

If you do not want to change the geodatabase schema, then you can do the following:

Convert your barcode question into a hidden question and add the calculation above to it.

Add a new barcode question, set the label and all as you like and MAKE sure you have  it as esriFieldType null

JamesKelly4
Occasional Contributor

genius! Thanks a ton!

0 Kudos