Previous Next

To open or use this sample form, go to the Design tab, scroll down to the Your forms and datasets section, and click + then Start new form; then enable Use a sample form as your starting point and choose Rosters: Choosing among earlier entries (variation 1) or Rosters: Choosing among earlier entries (variation 2) from the list. You can also click here (variation 1) or click here (variation 2) to download the spreadsheet form definition.

This sample has two variations, both of which populate the possible answers to a multiple-choice question with the household member names entered earlier in the survey. In both, the choice lists are on the choices sheet of the spreadsheet form definition as follows:

list_namevaluelabelfilter
hhmember1${fam_name1}1
hhmember2${fam_name2}2
hhmember3${fam_name3}3
hhmember4${fam_name4}4
hhmember5${fam_name5}5

The labels for the choices come from the names entered earlier, and the filter column is used to filter the list so that only the appropriate number of names are shown (i.e., so that blank names don't appear when there are fewer than five household members).

The choices are shown (and filtered) for the "worker_hhmember" field on the survey sheet:

typenamelabelchoice_filter
select_one hhmemberworker_hhmemberWhich household member?${numfamily}>=filter

The difference in the two variations of this sample form is as follows: variation one prompts for household member names in a series of fields named fam_name1, fam_name2, etc.; variation two uses a repeat group to prompt for household member names, then has to pull the names out of the repeat group using a series of calculate fields named fam_name1, fam_name2, etc. These calculate fields are defined as follows:

typenamecalculation
calculatefam_name1indexed-repeat(${fam_rg_name}, ${fam_group}, 1)
calculatefam_name2indexed-repeat(${fam_rg_name}, ${fam_group}, 2)
calculatefam_name3indexed-repeat(${fam_rg_name}, ${fam_group}, 3)
calculatefam_name4indexed-repeat(${fam_rg_name}, ${fam_group}, 4)
calculatefam_name5indexed-repeat(${fam_rg_name}, ${fam_group}, 5)

These calculate fields use the indexed-repeat() function (see Using expressions in your forms) to pull the names from the earlier repeat group and put them into individual fields that can be referenced in the labels on the choices sheet.

Previous Next