Hi,
In a form for an inventory made with many groups and sub-groups, I have a repeat to enter many species. I must enter one specy per repeat and do not have the same specy entered twice for a parcel. Specy is entered from a select_one list presented as an auto-complete list.
I'm trying to do that if a specy is entered in the first repeat and that I try to enter it again in repeat 25,I could not enter it in 25 by being advertised by a color, by a text, or being unable to choose the same specy an other time during the repeats.
Example:
values entered
Repeat 1= Abies ×phanerolepis
Repeat 2= Abies balsamea
Repeat 3= Acer pensylvanicum
...
Repeat 25= try to enter again Abies ×phanerolepis and seeing in color, being advertising that it is already in the previous answer of Repeat 1 to 24, or something like this. Another way could be to remove from list the answers previously added.
Any idea how to do it?
Thanks,
Hi Chantale,
This is possible by using a combination of the 'join' function to get a list of the values that have been entered and the regex() function to check for 2 or more entries of the current repeat. See the attached example. To break down the regex pattern:
regex(join(",",${prov_terr}), concat("(.*", ${prov_terr}, ",?.*){2,}"))
Note that there is currently an issue with Survey123 raising constraints when the first value in a repeat sequence is valid. As a substitute, you can have a warning note appear to alert the user the value has already been entered.
Thanks James,
If the values (species) are coming from an external database by a pulldata function, how should I add it in the function?
Ex.: A .csv that include species only
Thanks for your help!
The method of where the species comes from shouldn't matter, just the check for identical values in the answers.