I am trying to build a form that collects information on all household members and then produces a dynamic list of only those members which are 18 years or older to be used in a select_one for follow up questions.
I have managed to build a list which just excludes the labels for members under 18yrs but cannot work out how to 'compress' the list to only show adults.
The issue is that enumerators could still select the 'blank" labels of children by mistake as it currently stands.
Any advice would be helpful as i have run out of ideas,
In your case, what you'd want to do is change your respondent select to select_one ${Calc_HHName}. This will then create a select question with the choices composed of all the names entered in the repeat.
Now all we have to do is filter the options! We can add a choice_filter column to the survey worksheet to facilitate this, and then filter by age. In your case, this looks like ${Calc_Age} >= 18 as the expression placed in the choice_filter. This results in the select_one question only offering the names of people who are 18 or over as options. You can read more about choice filters in the docs here: https://docs.getodk.org/form-logic/#filtering-options-in-select-questions
Here's a working version of this form: HHMemberDynamicList.xlsx (158.3 KB)
(Note that I did remove the field-list group inside the repeat, as that was giving me an unrelated parse error). You can accomplish the same effect by applying field-list to the repeat itself.