I've been working on Survey123 form with the repeat question. In the repeat question, there are 2 questions namely "Scoring Criteria" and "Score". In the "Scoring Criteria" question there are the following choices: A, B and C. In the main question, there are columns "Score A", "Score B" and "Score C". I want to pass the value from the "Scoring" response in the repeat question to the "Score" field in the main question based on the selected criteria.
This is my XLSForm configuration:
This is the expected result:
This is the given result:
In addition, how to prevent multiple responses be submitted based on the criteria in the repeat question?
I'm not sure if you need a repeat here if you have a set of questions and a set amount of repeats. But anyway.
What you can do is use the below to refer to a question within a specific repeat:
indexed-repeat(question, repeat, index number)
You should also consider the repeat_count to limit the number of repeats (e.g. 3 for A, B and C).
You can also consider calculation modes in the bind parameters, if the calculations are not re-triggering.
If you have a look at the Samples in Connect, the one for JavaScript has a use-case almost identical to what described above. The difference is that it is calculating Standard Deviation.