I created a repeat group and I want to build logic to count the number of times a user choses certain answers to a specific question during the x number of times a repeat group repeats over itself. Can I use the count() function and build an if statement around it? How can I count specific number of times certain answer values were chosen for a single-select question?
How to count answers to a question in a repeat group in CommCare
commcare
Related Topic
- CommCare – How to Use jr:itext Logic to Display Question Answers on a Label
- Displayed label for repeat group
- How to conditionally display possible answers to multiselect (checkbox) questions based on previously entered information in CommCare
- In CommCare can the question labels in the data export to be set to a non default-language
- Use previous value within a repeat group
- How to trigger CommCare to create user cases
- Can you create child cases from a repeat group in advanced modules in CommCare
- Display condition error in repeat group controlled by user-input question
Best Answer
You should be able to write the below:
You'd have to create different hidden values for each answer. And be sure to put those hidden values outside the repeat group.
"repeat_group_id" is the actual repeat group. "question_id" is the question withing the repeat group, so if that question is inside folders you'll need to include those in the path.