Parsing variable length text strings from barcode data

1296
4
12-01-2017 11:44 AM
Status: Implemented
RebeccaFuda
New Contributor III

I would like to be able to take data from a bar code or QR code and split it up to populate multiple fields in a survey.  For example, QR codes on hunting licenses contain info on hunter first and last name and license #.

1798765432139 4ELWYOMING SPORTSMAN 112345678910

 

The information I would need to extract is the first 11 characters, which is the license # (17987654321), the following two characters are the hunt area (39), first name is Wyoming and last name is Sportsman.

I understand that I can use the substr() function to extract text at known positions, but this would not be sufficient to extract hunter names.  It would be great to have more flexibility for extracting text, similar to how text can be extracted in Excel using the functions such as FIND, LEFT, RIGHT, MID, etc.

4 Comments
ScottPrindle

Hello Rebecca,

Thank you for submitting this idea! It is currently Under Consideration to possibly be included in a future release.

Others,

When voting for this idea, please consider leaving a comment to share your perspectives on it. We would like to know what other projects or workflows this functionality would improve.

Thanks,

Scott

IsmaelChivite

This functionality is ready for testing now in the Survey123 Early Adopter Program.   Specifically look for the Custom pulldata() JavaScript Functions announcement.  Essentially, you can pass your barcode string into your own JavaScript function and then output the parsed string so you can use that in a calculation.

JoeFlannery

I would like this capability for parsing an email address of the survey form users.

Parse the first name and last name from:

John.Doe @ domain.com

to "John Doe"

JamesTedrick
Status changed to: Implemented

To note, custom JavaScript functions (which would allow for the text parsing described) were released in the 3.10 release