How to extrapolate data from QR Code

Last updated: Oct 2nd 2020

QR codes are a convenient way to store all kinds of data in a small space and are easy to generate and use.
 
A single QR code may encode different pieces of information that can be inserted in other programs such as an excel spreadsheet, inventory software, etc.

But to insert the data contained in a single QR Code in different fields of a program, it’s required an additional step.

 

For example, you may have a QR Code which contains more information in different lines, like this:

Mr John Smith
132, My Street,
Kingston, New York 12401
United States

and the corresponding QR Code is:

if you want to extract the data from the QR Code into the cells of a spreadsheet, like this:

you’ll need to split the initial string using as separator the \n character.

 

To do that follow this procedure:

  1. Open Barcode to PC server on your computer
  2. Click the settings icon (up-right side)
  3. Click the BARCODE component that is in the Output template field and enable the Skip output option
  4. Drag & drop the components from the Available components field to the Output template field a TAB component and a JAVASCRIPT FUNCTION component
  5. Click on the JAVASCRIPT FUNCTION component that you just added and edit the JavaScript field to read: barcode.split('\n')[0]
  6. Repeat the previous step and increase the number on the square braket to capture the various pieces of information, eg. barcode.split('\n')[1].

 
as shown here:


 
 

This way the BARCODE component will take care of acquiring a barcode and store its value in the barcode variable.
The JAVASCRIPT FUNCTION, instead, will read the data stored in the barcode variable, split the string into multiple pieces, and return the n-th piece specified by the number in the square brackets.

 

Or, alternatively, you can import the .btpt file (Output template file) of this example and then edit it to fit your needs:

 

After that your Output Template is set up you can save the server settings, position the cursor of your computer in your software where you want the data to be typed in, and scan from the app.

Comments

No comments found. Be the first to leave a comment.

Your email address will not be published. Required fields are marked *

Related posts