Steps of printing barcode and auto fill the for by scanning barcode and continue updating another form

Hi All,

I am currently working on a project and which requires collecting patient information from the field and provide them a barcoded referral form. When the referred patient will visit the health centre for test, we need to scan the barcode and autofill with the information of that patient and them update the form with some additional information. I know there are some existing documentation. However, I am quite confused about the whole process. Some simple stepped instruction may help me a lot to move forward.

Another quick question is there any way of using my home printer instead of zebra for test purpose for the time being? is it the right Zebra printer?

I would appreciate your support.


Another method which is a lot more simple (in my view) is that you pre-print the code labels (I would rather use qr code).

As @Trung says, you can build and print the code any way you want. For example you could use something like The Zebra printer is if you want to use the form to collect data and print a code from it. For example @Mic has a form for registering participants and prints name badges for them.

What I would do in your case is create a CSV with the first column being the ID that will be in the code and then the next columns for whatever data you need preloaded. Then you can use pulldata to look up the id from the code and populate the corresponding fields in your form. See for documentation on pulling data from CSVs.

Edit: it seems you do want to also print a code on the initial encounter. The printers supported by the Zebra print drivers are at So yes, the one you linked to would work. You could also use a computer and regular printer since you'll most likely want to encode just an ID.

1 Like

If I were you I would get a bunch of codes like this

1 Like

Dear Hélène,

Thanks a lot for your guidance. However, it's just me take some time to understand things. I have tried preloading the example forms and tried to follow the instructions. Now I have few questions as the following:

  1. For example, I have a form for outreach workers for finding patients in remote areas. So the form may have the columns:
    id name contact_number DOB address
    based on the collected information, the outreach worker will print a barcoded form to the suspected TB patient and ask them to visit the nearest health facility for screening.
  2. Next step, the suspected TB patient visits the health facility for screening on the same day and presents the barcoded referral form. At the health facility, we have a form with the same columns:
    id name contact_number DOB address [additionally] test_result
    My aim is to come up with a system to partially fill out the second form by scanning the barcode and complete the rest of it, once the test is done.

I am a little confused about some basic things. Can I include multiple information in a barcode? Does a barcode represent set of information or just a code? If it's just a code, how do I know, who is appearing for test. For example, the field workers referred 4 (W,X,Y and Z) suspects for the day. By scanning the code, how do I know, who appeared for a screening?

I would appreciate your support.


@Trung's idea of having pre-printed barcodes with unique identifiers is a really interesting one that could dramatically simplify the workflow depending on your needs. For example, the first form could ask for id, name, contact_number, etc and to scan the pre-created barcode that the patient will be given. That would associate the random unique ID in the barcode with the patient.

At the health facility the form could then ask for barcode scan and test results. Then the information could be linked through the unique ID from the barcode by someone doing data analysis. This is a simple system that plays well to ODK's strengths and works entirely offline.

The downside is that name/contact_number/DOB/etc won't be verified at the health facility. If that is necessary, then you could encode the information in the barcode and print it from the intake form using a Zebra printer. You could then read that from the health facility and ask the patient to confirm each field and give them an opportunity to update the info if needed.

To directly answer your questions. You can include quite a bit of information in a QR code but encoding just a unique identifier could lead to a simpler workflow. You would then use that unique identifier to link the health facility record to the patient info record.


Dear Hélène,

Thanks so much for all the information you have provided so far. In fact, I need to go for option 2: include name/contact_number/DOB etc in a QR code and print that using Zebra printer and once the referred suspect will appear at the health centre, retrieve patient information using the unique identifier to link the health facility record to the patient info record.

Is there any example guideline or example form available to include few columns of data into a QR code and print them and guideline and example form for the health facility to scan the QR code and retrieve patient information. One thing I would like to mention here: the referred person is not pre-registered at the health facility record. I need to scan the QR code and view the information on screen and input result.

Thank you once again,

Hi @LN, thanks for your comment. I agree with most of your points, except for the quoted one. Maybe I haven't fully got it, but I don't see that it's necessarily has the downside. There are a few things to note:

  • The QR codes (or barcodes) are completely unique (we have pre-printed millions of them, and the ones in my picture previously are some of those.
  • Once you're in a data collection and you use it in a form to assign an object with it, the assignment is completely unique in the sense that the code helps you get to the information later very easily. The verification of the accuracy of the entered information is another process in my view.

I am attaching a form mockup we have used developed for a traceability use case FYI (I'm sorry for the labels in Vietnamese, but the one I highlighted is in English for your information).

1 Like

I've put together a simple example that should at least give you ideas.

Here is a sample intake form. It asks for some identifying information and then sends that to be printed as a QR code. I don't have access to a Zebra printer so I can't verify the barcode but I believe I did it right (hah! I hope so at least!).

Here is a sample encounter form that reads in the values from the barcode and asks the enumerator to confirm each field and/or correct them. I've verified it with the following QR code:

Note that I'm kind of abusing selected-at in order to separate out the different fields. Using select-at means the QR code must contain space-separated values which also means the values themselves can't contain spaces. If that's a problem we can explore some alternatives.

A couple of issues to note:

  • Using hardware printers in the field is risky. You'll need to have a backup plan if you can't print for some reason (out of batteries, bluetooth fails, etc).
  • The QR codes will contain patient data in clear text. This could be a security/safety issue.
  • The patients could lose their QR code. You'll need a backup way to identify them.

Handing out pre-printed codes is simpler and less likely to fail. It doesn't sound like you're collecting much patient data so you could just have both the intake and the health facility forms ask for the info and verify that the records match later. Remember that they will be linked by the QR code identifier. This is common -- even in the US I seem to have to fill out the same info every time I see a health provider. And on a piece of paper, too!

1 Like

Dear Hélène,

Thanks so much, this is exactly something I was looking for. This is a complete solution to move forward. Of course, it's my turn now to make it better. And for this case, I will keep posting my real life experiences here, so that others can also learn.

Thank you once again for finding such a great solution.

Dear Hélène,

Though I got my answer; however, considering the points you mentioned makes sense. In that case, I believe I need to have pre-printed QR code, that @Trung mentioned. My question is:

  1. when I will pre-print the QR code from the bulk online QR code creators. what values should I have for those QR codes?
  2. How do I encode the information I will collect into that preprinted QR code instead of printing one using Zebra printer. it sounds more convenient.
  3. @Trung how do you create those QR codes? I have tried few online QR code creators and all of them ask for some value, they don't generate random QR codes.

Thanks again,

We have our own system that generates qrcodes in PDF. Then, we hire a printing house to print the labels. If you need to have thousands of them. I think you can buy them.

Nothing really particular, in my view. It's just a little assignment exercise. You assign A (whatever it is) to B (the pre-printed qr label). By this, you can always get to A via B.

Hi Hélène @LN,

If I collect data using this method at the field level for the suspected patients. Once they will come to the facility for a screening test, a receptionist will screen the QR code and enter the test results once the test has been performed. Here I have another issue: I need to make sure that the person has been referred for a test, appeared at the health facility for a test. How do I link two entries? Instead if using two different forms, I am using one form for referral and for the health facility. Please see the attached form active_case_finding.xlsx (16.8 KB)

Is there any way to validation or group entries same person. The objective is, on data analysis, I need to identify how many suspects we have referred and how many appeared for the test.


I'm having trouble understanding your process! It sounds like you will have two forms, right? And then you want to link the two on post analysis?

One thing you could do is introduce a calculate field with uuid() in the calculation column for the first form. This will generate a unique identifier. You could include that in the barcode and read it like you do the other fields from the second form. That will let you connect the two records on analysis.

1 Like

I Also dont understand where the issue is exactly...
ODK is for collecting the data, the unique identifier links them...
And then you have an analytic program that helps you filtering, manupulating, fusing, making nice graphics.

So an Example how it can be done:
For a Community Center we register the participating children with the form that i attached.
It generates a barcode consisting of an ID and a random Badge Number that are written in a Barcode. You can compose whatever string you like in the barcode.
Then the registration Data is in the Database and the barcode is unique.

If the "Customer" visits a class or other event, we scan the barcode. for this we have a second form "Event Reporting" where we can create a list of participants.

Then in the analytic program, in our Case PowerBI (i really suggest this one :)) we have a filter mask to search for a participant and see which events she/he visited.
Participant-Registration.xlsx (13.1 KB)

1 Like

If you are looking for a printer... Zebra MZ220 is generally working but from time to time it loses connection to the device and the device must be restarted.
For an Acer ZEST Plus this happens quite often...
For an Acer Iconia tab 10 its much more stable.
I think the crashes are a memory overflow or something in the printer driver. Depending on your use you should invest a bit more in the Android device


Dear @LN and @Mic,

Your supports were really helpful and exactly what I was looking for to identify the participation of the TB suspects registered using my form. In my case I combined both forms (example forms created by Hélène for me) and added an option at the beginning, so that I can use the same form for data collection and to include results of the TB suspects have been referred for screening. The reason I combined both forms to ensure that I can see both entries on the same page and to identify the number of suspects turned up for screening and number of suspects are missing.