Hi all-
I’m posting an example of a survey which fills in responses to a question from the answer to a previous question. This was created because for this survey we wanted to fill in the names of family members based on the household ID number. I had difficulty finding documentation for how to do this, so I’m uploading an example here.
The steps are as follows:
- Create an excel doc of the survey as normal.
- Create a CSV, using the same format as a the choices sheet- it needs a “list-name”, “name”, and “label” column. The list-name should be the same across all the possible answers and refers to the ‘name’ in the survey sheet of the question that needs to be dynamic. In this example, I’ve put the family members’ names in the "label’, and given them participant ID numbers in the ‘name’, so that the input to the question is the participant ID number, not the name.
- In the CSV, add an additional column, and name the column (I’ve named it HHID, short for household id). Put in the information that would make the question dynamic. In my case this is the appropriate household numbers for each participant.
- Go back to the survey, add in the question that needs to be dynamic, using the code “select_multiple_from_file filename” (in our case its 'select_multiple_from_file familyname.csv"). Add in the rest of the question. Make sure the name matches the list-name in the CSV file.
- Add an additional column to the survey sheet- “choice_filter”. This is what makes the question dynamic- add in the constraint under this column. In our case, filtering family members by household, we will put in “selected(${Household_ID},HHID)”, where the first variable is the question name from earlier in the survey, and the second variable is the column name in the csv file that filters the choices.
- Upload the excel doc to Kobo and add the CSV to Settings/Media.
Once the form is deployed, it should display the first question (in this case Household ID), and once you input the id, it displays the names of the family members in the next question (images attached).
Hope this is helpful! Not an expert here, just trying to make sure there’s clear documentation for this type of question.
dynamicquestionsexample.xlsx (10.6 KB)
familyname.csv (1.8 KB)
I’ve tagged the pull-data tag mainly because this was the function I thought I needed to use for this question, although it is not the function that is ultimately used in this form.