How can I adjust follow-up repeats when answer from select_multiple changes?

For what you describe, I'd generate as many repeat instances as there are choices and use relevance to only show the contents of the repeats corresponding to the choices that were selected. This is truly dynamic based on the selection and it allows for choices to be selected and unselected without their consumption frequencies being lost during a form-filling session. See an example here.

An inconvenience with this approach is that you'll see 25 repeats for every submission even though most will typically be empty. These should be easy to filter out so it doesn't seem like a big deal to me but it's something you should be aware of. An alternative is to "unroll" the repeat and have 25 groups with relevance based on the selection. The advantage of this strategy is that analysis on a per-vegetable basis would be very easy.

@Fabla the clearing-related issue is filed at https://github.com/getodk/javarosa/issues/627. However, clearing all the counts when the select value changes doesn't seem like a very good user experience. I hope what I've outlined above will serve this need.

2 Likes