Warning if QR-/Barcode is scanned again

Dear all

We have QR codes attached to plants and scan them to enter data about this very plant. There are many plants next to each other and it might happen that one attempts to scan the same QR code again which should be avoided.

Therefore we would like to implement a warning popping up when then QR code on a plant is scanned again, i.e. "You entered data on this plant before". I thought about a constraint with a lookup in the data entered up to that point but didn't find a way to implement this.

We are using KoboCollect and the xlsform generator.

Thank you very much for your help.

Are you scanning inside a single form submission? Or across multiple forms submissions? Unfortunately, this sounds like something you might need to use ODK2 to implement.

Hey, thanks for your quick reply.

This is supposed to work within a single form, with the same tablet even (we work offline).
So we collect the same data on each plant but want each plant only once. Therefore we want a warning in case we attempt to collect data on the same plant again.

I'm curious if there is a somewhat simple solution with relevantor constraint?

Any help much appreciated!

If using a repeat group you might be able to do something with count() and indexed-repeat() functions. I suggest searching the forum with some combination of "value", "indexed-repeat", "previous answer", and "count" to see how other people have used these.

If you have a question/line for each barcode scan (not a repeat group), then I was wondering if it was possible to use calculate questions to combine the values from the previous barcode scans and then use a regrex as constraint to look for the new value within that string. This would get messy/long and have a problem if your concatenated barcode gets too long (there are character limits for field values). Also, I experimented with this and had trouble using answers from other questions inside a regrex expression.

Also messy, but if not using a repeat group, it should work to just build what will become a really lengthy constraint:

|  type   | name | label  |              constraint               | required |
| barcode | bc1  | Scan 1 |                                       | yes      |
| barcode | bc2  | Scan 2 | ${bc2} != ${bc1}                      | yes      |
| barcode | bc3  | Scan 3 | ${bc3} != ${bc2} and ${bc3} != ${bc1} | yes      |

Another thought, to try and reduce user error, is to include a hint or use a note displayed on the same screen above the barcode prompt (using a group and appearance = field-list) telling the user something such as "Before pressing 'Get Barcode', position the phone directly in front of the next barcode to be scanned."

Thanks for your ideas!
We are using a repeat group, so each plant is one entry for which we collect the same data. I searched for the terms you suggested but didn't get much further.

In case we canĀ“t solve this we might just mark the barcode with a permanent marker so that we know the data is already entered. But of course, a solution implemented in ODK/KoBo would be awesome!