Understanding Barcode Questions in Survey123 for ArcGIS

9630
59
05-16-2016 07:58 PM
Esri Frequent Contributor
7 59 9,630

A barcode is an optical machine-readable representation of data. A lot of things around us have barcodes. You will find them in virtually any packaged item you buy, in the back cover of books and most likely somewhere in the laptop, its power adapter, or the PC you may be using right now.

Typically, barcodes are attached to things using a sticker, or simply printed on them. You can put any data you may want in a barcode, but generally they are used to unequivocally identify the item.  Barcodes are designed to encode data in a way that can quickly be scanned using either a barcode scanner, or through the camera of your smartphone.

The canonical use of barcodes with Survey123 for ArcGIS is that IMG_0015 (002)b.jpgwhere an asset, like a pole, meter, pipe etc has a barcode in it; Field users with Survey123 would scan this barcode to quickly bring the unique identifier and other asset information into the Survey. In this way, room for error when capturing the unique identifier of the asset is removed, not to mention that capturing the data is very quick.

In this photo, you can see a field user leveraging Survey123 barcode scanning capabilities to support sign inspections. If you look close enough, you will be able to see that the pole and the sign have both a sticker with a barcode. The barcodes include information about the unique ID of the asset, ensuring data integrity and simplifying the completion of the Survey.  Many thanks to Gary Bowles, GIS Database Administrator at Seneca Resources Corporation for the photo and his continuous feedback on Survey123 for ArcGIS.

Types of barcodes


There are multiple flavors of barcodes, which we can organize into two categories: linear and 2D (matrix) barcodes.

The original barcodes where all linear. They were invented in the 1960's, UPC.pngpopularized in the 1970's and still the most commonly used today. Here is a linear barcode representing the value 036000291452.


Two-dimensional barcodes can encode more information. A popular one these days is the QR code, which you may have already used from your smartphone, may be to quickly access a web site, or to download a mobile app.

QR.png


There are actually lots of different types of barcodes, even for each of these two categories. Choosing one type or the other will depend on what type of data you want to encode (not all types support international characters for example), the size of the data, the amount of space you have for the sticker, etc

Another important aspect before choosing the barcode type to use is licensing. Many barcode styles are patented and you could not use them to print your own data.  You can learn more about the different types of barcodes in Wikipedia.  From a practical perspective, if you would like to create your own barcodes, a safe bet is to go with a 2D style, as it will give you good flexibility to store data of different sorts. And one that is in the public domain, such as Aztec or QR Code.

There are different ways to create barcodes. To start playing around a bit, I personally liked qr-code-generator.com and also barcode-generator.org. You will also find API's, to create these barcodes programmatically, as well as solutions of all sorts to print stickers: in bulk, from a pocket printer, to print waterproof barcodes etc  There is really a world around barcodes. If you are hardcore enough you will even find people who will tattoo them on you.

Barcodes in Survey123 (The Basics)

Smaller.gif
If you would like field users to be able to scan a barcode and get the data added to your Survey, you need to add a barcode type of question. Barcode questions, by default, are shown in your form as an input box -where the user can manually enter data- plus a barcode scanner button, which will trigger the device camera.  By simply focusing on the barcode, and tapping on the camera, the barcode will be scanned and the data from it added to the input box of the question.

By now, you know that there are many types of barcodes. Survey123 for ArcGIS supports a very specific subset of them: QR Code, Code 39, Code 93, Code 128, EAN 8, EAN 13, UPC A, UPC E, UPC EAN Extension, Aztec, Codabar, Data Matrix, ITF, MaxiCode, PDF 417, RSS14 and RSS Expanded.  If scanning fails, the first thing to check is if Survey123 is configured to scan the type of barcode you are targeting.  Use the menu button in the top-right corner to configure the scanner.   You can configure the barcode scanner to scan any of the supported types if you like.

A Barcode Scanning Survey Sample has been added to Survey123 Connect for ArcGIS, so you can get started. Open Survey123 Connect, click on New Survey, and then look in the Samples category. Publish the Barcode Scanning sample survey and download it into your own phone or tablet. You can exercise scanning with some of the barcodes added in this blog post.  You can alternatively download the sample barcode XLS file from here.

Minimal Appearance in Barcodes and Calculations

Barcode questions in Survey123 for ArcGIS support the minimal appearance. When used, the question will not show any type of input text box. Instead, all the user will see will be the name of the question, as well as the button to start the scanner.   The minimal appearance in a barcode question is typically used in combination with calculations in other questions: the barcode question is used to fetch data, and the calculations extract that data and display it to the user.


Say for example you want to use a barcode to store the Unique Identifier of an asset and the company that produced it. We would not want to show all that information in a single field, because it would be confusing to the field user, and somewhat useless stored that way. So we hide the raw data obtained from the barcode (minimal appearance), and then we use calculations to split that content into two separate questions... like in the following example:

barcode11.png611FFA1 Stark Industries .jpg

For your convenience, here is a QR Code that you can use with the example above. This idea of using barcodes to persist an array of values at fixed lengths is very common. Using the substr function in calculations makes it relatively easy to auto-complete one or many questions in your Survey.

Enough talking! It is time now for you to try!

59 Comments
Occasional Contributor III

This is fantastic!  Thank you all for your continued development of this app and the barcode functionality.  Is the "minimal" appearance potentially device specific?  When I use the template for barcode scanning and look at the resulting survey the minimal and non-minimal barcode questions look the same.  Do I need to refresh the app from the app store?

Esri Frequent Contributor

Hi Brandon Keinath​  You certainly need to update your mobile app to 1.4.28 or newer. The app is available in the app stores.  Do not forget to submit any data you may have pending to be sent in your device before you update the app.

Occasional Contributor III

Thanks for the quick reply Ismael!  You're absolutely right and after updating the app I now see the "minimal" appearance.  We're using this app a lot within our organization and I'm very excited to see where it goes!

Occasional Contributor II

Can survey 123 be used with an external barcode scanner attached/bluetooth connected to a mobile device instead of using the camera on the device?

Occasional Contributor II

Adam,

This is an interesting idea, but probably wouldn't work, unfortunately. The barcode question launches the camera and then scans the image(s) it takes for a readable image, an external barcode scanner likely wouldn't give the app the data in a format it can use.

Occasional Contributor III

They used to work prior to the upgrade to using the camera. We used a bluetooth scanner and it sent the text data attached to the barcode back to the survey. Not sure if this will still work but i will try it with one of our external scanners and let you know.

--gary

Occasional Contributor II

Thanks. I am trying to use the camera to do this but cant seem to get the scan to work. I have tried a number of different bar code types including "any" and it just keeps telling me "scan failed, try again". I was hoping using an actual scanner could solve that.

New Contributor III

Hi guys,

I just want to ask if it is possible to use Survey123 with password protected QR Codes. We tested several password protected QR codes but every time we use Survey123 to scan them, we are prompted by an error message "Scan failed". Hope you can help me with this.

Thanks,

Karen

Esri Esteemed Contributor

Hi Karen,

By "password protected", is the data stored in a QR code encrypted and then requires a password input in the app to decrypt?  If so, Survey123 doesn't have a capability to prompt a user to decrypt the text nor functions to automatically decrypt the text based on the answer of another field.  It should successfully scan but present the encrypted text.

New Contributor III

Hi James,

Thank you for the response. To answer your question, yes the information stored in the QR Code is encrypted and needs a password to capture it. Scanning the password protected QR Code is always not successfull using Survey123 but when we tried a normal QR Code scanner it prompted for a password. Are you aware of any workaround for this type of use case?

Thanks,

Karen

Jesusa Poquiz‌ 

Esri Esteemed Contributor

Hi Karen,

Which application(s) did you use to scan the encrypted QR code?  In doing a bit of research, the only application that does this is the Android app QR Droid, which is doing as a feature of the app- there isn't any standard for encrypted QR codes that I can find. (Secure / Encrypted QR Codes - Stack Overflow  and QR Droid Mobi  are what I could come up with).

New Contributor III

Hi James,

We are using QR Scanner, a free android app to scan an encrypted QR Code. I attached the screenshot of the mobile app.

       

 

Thanks,

Karen

New Contributor II

Hi, Is Priscila from Ecuador. 

I have a problem, when using barcode in survey123. Performs the scan and stops the application.
Esri Esteemed Contributor

Hi Priscila,

The barcode scanning feature is a relatively resource-intensive component, as it both shows live video and attempts to analyze the image for the barcode pattern.  What devices are you using?  In the longer term, we are working to improve the barcode component and make it more efficient.

New Contributor II

Hi, i tried with two mobile phones: Samsung S4 mini and Samgung A5. 

What are the minimum requirements of the mobile device, for the correct operation of bar code
Esri Esteemed Contributor

Hi Priscila,

The Samsung S4 mini is certainly at the very edge of our support.  I would expect the A5, depending on the year, to be reasonable to good performers (do you know which year - 2015, 2016, 2017 or Android version the phone currently has?).  

One thing noted by our barcode widget developer is that there are 2 methods of capture- one that uses low resolution and another that uses higher resolution; it may be that the phone can't enter the low resolution mode.  If in higher resolution mode, you may hear the camera 'click' sound as the image is taken and saved (as opposed to scanned off the video in low res).  It's also evident as a more 'stuttery' video stream.

Also, what barcode format are trying to scan?  Some barcode formats are more complex to decode than others.

New Contributor II

Thanks James, I am going to try with another celphones.

Esri Esteemed Contributor

Hi Priscila,

There currently isn't a function that can separate text based on a delimiter in the XLSForm specification.   We have given a bit of thought on this, but it will be a while before we approach this with a workaround.

Occasional Contributor III

James & Priscila,

We are using the pulldata function with barcode scanning to automatically fill in data fields (See attached). This way we can extend the data that we pull from our barcodes. This is working great to ensure that we receive certain data exactly how we want and to reduce time in the field for the survey takers.

--gary

Gary H. Bowles, GISP

GIS Database Administrator | Seneca Resources

Office : 412-548-2544 | Cell Phone: 412-334-5273

Occasional Contributor II

I am still unable to use the scanner in Survey 123  with an iPad. I've tried with iPhone and android phones as well with limited success. Our problem could be the bar codes are up high so you have to hold the ipad up to scan them. Also there are often 2 bar codes stacked on top of each other, so trying to use the camera to capture only one is difficult. We have external scanners (Motorola and Symbol) that shoot the single laser line at the bar code and work just fine, but I'm not sure how or if I can use those to work with Survey 123. 

Esri Esteemed Contributor

If the external scanners can connect via Bluetooth to the devices, they should be able to fill in the barcode fields.  However, they also take over the keyboard of the device; currently the on-screen keyboard does not display when the scanner is connected

New Contributor II

Thanks Gary! I am going to try this. 

New Contributor II
Can you recommend devices that have effective barcode operation?
We have to acquire devices for this information collection.
Occasional Contributor III

We are using the following devices in the field to scan QR barcodes and we have had no issues:

iPad mini 2

iPhone 6

iPhone 7

Samsung Galaxy S5 phone

Samsung Galaxy S6 phone

I will be testing an older ASUS tablet next week to see if we can put it into service as well.

We are also using Aulux Barcode Label maker Enterprise Edition to create our barcodes.

--gary

Gary H. Bowles, GISP

GIS Database Administrator | Seneca Resources

Office : 412-548-2544 | Cell Phone: 412-334-5273

Occasional Contributor II

That is good news. These do have Bluetooth. I have connected a Motorola MC55 via Bluetooth to our iPad. From there I am launching Survey 123 and my data collection template. However when I go to "scan" it still is activating the iPad camera and not giving any indication it can use the external scanner. I tried scanning with the Motorola but no data carries over into my survey template where the bar code would appear. 

Occasional Contributor II

I noticed our handheld scanner is running Windows mobile 6.1 pro and platforms supported for Survey 123 appear to begin at Windows 7. I'm wondering if I updated windows on this device would it work, or is there a setting I have overlooked and need to try first before going this route.

Esri Esteemed Contributor

A Motorola MC55 isn't a scanner per se, it's a mobile device in its own right.  While it has bluetooth, it probably won't act the same way as a dedicated scanner would.

Esri Esteemed Contributor

There's a significant difference between Windows Mobile & Windows - the last version of Windows Mobile was 6.5 (and in this type of device, the next appropriate version was Windows Phone 8, which would be unlikely to run on the device).  Even so, it probably would not connect to the iPad in a way to transfer the barcode information.

Occasional Contributor II

Thank you for the reply. I don't suppose  loading/running survey on the Motorola would be an option either even if we updated to windows 8? We would like to use survey, just having a hard time finding a work around solution since the iPad cameras will not read the bar codes. 

Occasional Contributor

Is there a way to set the barcode scanner to "all types" by default?

Occasional Contributor III

Is the barcode scanner compatible with driver's license?

Esri Regular Contributor

Hi Erica, yes, the specific barcode type for Drivers License is 'PDF 417'

Occasional Contributor III

When I have my Survey123 app set to accept "all barcodes", I end up with a garbled input that matches a alphanumeric code on the back of my license. When I change the barcode type specifically to PDF417, I am unable to scan my license at all.

Are there additional steps I need to take within my XLS form before the scanner will function properly? If there are, do you know of any resources detailing how to break out the content from the barcodes?

Thank you!

Esri Regular Contributor

Hi Erica, you will want to specifically select the PDF 417 (as you have done).  I have found that attempting at different zoom levels (for me, zoom level 3 with an iPhone 😎 can make a difference.  In addition, ensuring you have ample light when taking the photo (consider flash) can help.  We are currently looking to improve the ease of scanning PDF 417 barcodes.

As for parsing out the string of information that is returned, we do not currently have an out-of-the-box method.  Some users have been playing around with building a custom JavaScript function, that would be used with the puuldata function.

More information related to custom pulldata() JavaScript functions can be found in our Early Adopter Community

Occasional Contributor

Is there a way to use a BARCODE to pull up a record from a feature service?  I have a feature service of poles.  One of the columns in the Feature Service is the BARCODE#.  I want the fieldworker to scan the barcode and show the correct record (fields and geopoint/map) corresponding to the BARCODE# stored in the Feature Service.  I can get this to work with pulldata() and a CSV but want to use a Feature Service instead.  Is this doable?

Esri Esteemed Contributor

Hi Jonathan,

We have beta functionality in the Early Adopter Community that could meet this requirement.

Occasional Contributor

Thanks, I will take a look.  Any thoughts/tips on where/how to find the barcode piece in the Beta that would help me?

Esri Esteemed Contributor

The link should take you to the appropriate document- custom JS functions.

Occasional Contributor

Thanks James, any tips/advice on how the "calculations" would look like to read a barcode and populate the form from the Feature Service (including the geopoint) to do this?  Let me know if you would be able to call me to discuss 520-724-2678

Occasional Contributor III

Hi Gary,

Could you send the attachment you mention here please or outline your process. Interested in using Bar Codes to auto-populate forms.

Craig

Occasional Contributor III

Craig,

I think this is what I had sent. Hope it helps.

--gary

Gary H. Bowles, GISP

GIS Database Administrator | Seneca Resources

Office : 412-548-2544 | Cell Phone: 412-334-5273

Occasional Contributor III

Hi Gary,

Please send attachment to cpoynter@csu.edu.au. I still cant see it attached here.

Regards,

Craig

New Contributor III

Does the barcode scanner have a character limit?  I have two barcodes, both Code_39, one with eight characters (plus * on both sides), and one with 22 characters (plus *).  The 22 character code won't scan. 

Esri Esteemed Contributor

Hi Eddy,

I am able to do a test scan of a 22 character Code-39 barcode with Survey123.  What device are you using to scan?

New Contributor III

iPad Air 2 & iPhone X

New Contributor III

Code-39 Barcode

Esri Esteemed Contributor

Thanks for the sample.  I can replicate the failure to scan with the sample and another sample I generated based on the string pattern of your sample and have filed an issue to investigate.

New Contributor

Hello. I couldn't to scan a white barcode with black background. I tried the different barcode types, no luck.

Esri Frequent Contributor

Hi Jeffrey,

Do you know what sort of barcode it is, the code type? Are you able to provide a copy/image of the barcode (scan or photo of it - best quality possible)? Also, what device and OS version are you using?

We have made quite a lot of improvements to barcode scanning in the upcoming 3.6 release, out of interest have you tested with the 3.6 RC builds available on EAC? There is a lot of improvements compared to 3.5 release when scanning barcodes on Android and 64-bit devices.

Phil.