Preload data by reading a barcode

I want to preload data by reading a barcode.
Instead of typing the unique identifier in a form to pull the data to preload on a form I want to scan the barcode. Is this workflow possible?

Thanks

1 Like

Hi zizi,

Yes it is possible.
You should prepare a support csv file with the barcode info in one of the columns, and the other preloaded info in the other column(s). After you scan the barcode, you create a calculated field that pulls from the csv file the information which has the column barcode equal to your ${barcode} variable. Important: the barcodes values in the csv file need to be unique.

If you want you can also create more advanced routines by combining the barcode with some additional details inputted by the user. In that case you would concatenate the two or more variables and look for the concatenated string in the support csv file.

I hope this helps.

1 Like

Hello Andrea_Martin,
I am trying to do what you told to do for preloading data for barcode but it's not preloading can you please help me by giving an example.
Thanks in advance.

FYI, you can accomplish an equivalent result using a (hidden) select_one question to effectively store your barcode-to-value mappings. Then, use a calculation to lookup your scanned barcode string, but this time using a jr:choice-name(barcode, select_one) function. [hint: you completely hide the select_one by setting its relevant=false()]

If you only have a few barcodes this might be a slightly simpler solution as it avoids having to introduce an external csv file into your workflow. But if you have lots of barcodes and/or they're generated from an external database then, as you suggest, looking them up in a csv would be probably be preferable to having to manually enter them all as select_one options when creating your form.

Hello @Ajmerry_Hossain

Apologies for the late reply, I just visualized your message.

Please find attached an example form using the csv preload feature.
It works as follows:
a- Scan a qr code (type 'barcode' in xls).
b- The value contained in the QR code is looked-up in the support file column 'qr'
c- The value of the 'field' variable in the corresponding record is pulled (calculation, appearance pulldata())
d- The 'field' value is displayed in a note message
e- if b) or c) fail, an error message is displayed

Note that you can customize the steps as needed, e.g. pull information directly from the qr code, or manipulate the info of the barcode (example substring) and pull data only using that bit, etc.

I hope this helps.

Best,
Andrea

preload_data_form_QR.xml (1.7 KB)
support.csv (111 Bytes)
preload_data_form_QR.xlsx (57.6 KB)

Hello, your answer helped me for my project, following your example if I only want to allow the qr numbers of the csv file as correct.
what would be the correct expression I use in constraint this: regex (., '^(?i)(\W|^)(1|2|3|4|5|6|7|8|9|10|)( \W|$)') but if you wanted tomorrow from 10 to 20.
Is there something easier? using pulldata thanks