Difference between revisions of "SurveyCTO Dynamically Populated Choice Lists"

Jump to: navigation, search
Line 6: Line 6:
== Coding Example ==  
== Coding Example ==  


Here is a [https://docs.google.com/spreadsheets/d/1jkqL2gUGlOGWXPyUF940V4BjH0iDjsxMt6168ncSr_s code example] of how the answers to a field inside a repeat group are used to dynamically load the answer options for a select_one or a select_multiple question.


This example dynamically load answers from a repeat group. If you were to dynamically load answers from fields not inside a repeat group, then you simple reference those fields directly in the choice tab.
This example dynamically load answers from a repeat group. If you were to dynamically load answers from fields not inside a repeat group, then you simple reference those fields directly in the choice tab.

Revision as of 02:01, 13 February 2017

Best Practice

Sometimes we want to ask a respondent to select one or several answers out of answers the respondent have given earlier in the interview. For example, we might want to ask who in the household out of the household members listed in the household roster module is currently employed. It is possible to do this by dynamically load previous answers as answer options.

Any answer can be used in dynamic choice lists, but when using variables inside a repeat group, one more extra step is required. We cannot reference a field inside a repeat group directly.

Coding Example

Here is a code example of how the answers to a field inside a repeat group are used to dynamically load the answer options for a select_one or a select_multiple question.

This example dynamically load answers from a repeat group. If you were to dynamically load answers from fields not inside a repeat group, then you simple reference those fields directly in the choice tab.

Back to Parent

This article is part of the topic SurveyCTO Coding Practices