1. What is the issue? Please be detailed.
The context is I'm propagating plants and I have tags with barcodes like G0001-G9999 that I'm putting on each plant as we graft/propagate and in the case of a single submission all the repeats are coming from the same source but going onto different new plants, but I want to make sure that as new tags are being put on plants, that tags do not get scanned twice to avoid duplicate scans and skipping one. In the case where you know you have 10 plants, you scan one twice and the rest 9 times, it would still give you a total of 10, but one of your tags wouldn't be scanned and. Its critical in this step as we label plants that each new tag is scanned once.
I have a repeat group with the first question as a barcode scan and I want to make sure that all subsequent barcode scans are not duplicated. My first thought would be to put a constraint. My current constraint for that barcode field is
regex(., '^[\*GCASTR][0-9]{1,4}(-[0-9A-Z]{1,4})?$')
How would you either modify this constraint or add other calculate fields to accomplish this so that 2nd repeat and beyond wouldn't allow you to proceed if that barcode had already been scanned?
2. What steps can we take to reproduce this issue?
3. What have you tried to fix the issue?
This simple example I saw to avoid duplicates selects in repeat group posted by @LN, but I don't think this would work here because the selected() function only applies to selects. This looks like it would be close, but would maybe need to change constraint function selected() to contains() ? Would anything else need to be changed? In my case since I already have a constraint for the barcode would I have to do something like:
and(regex(., '^[\*GCASTR][0-9]{1,4}(-[0-9A-Z]{1,4})?$'), not(contains(${so_far}, .)))