Filtering the questions in a loop (ask some questions, but not others)
You can filter the questions in a loop so that only some are presented to the respondent
Syntax
Put the following statement in the routing section:
<loop_name>[..].QuestionFilter = "<questions>"
Parameters
<loop_name>
The name of the loop.
<questions>
The questions to be displayed. This can be either a comma-separated list of questions names or, if the questions are consecutive, a range of names defined as Qname1..QnameN.
Parameters
FoodList define
{
Fruit, Vegetables, Salads, Fish, Meat, Bread,
Dairy "Dairy produce",
Pulses "Pulses/Nuts/Cereals",
PastaRice "Pasta/Rice"
};
TimesEaten "On the following days last week, how many times did
you eat ... ?" loop
{use FoodList}
fields
(
Monday long [0..10];
Tuesday long [0..10];
Wednesday long [0..10];
Thursday long [0..10];
Friday long [0..10];
Saturday long [0..10];
Sunday long [0..10];
) grid expand;
In this loop, the types of food are the answers (rows) and the days are the questions (columns). To restrict the grid to displaying weekend days only, place the following statement in the routing section:
TimesEaten[..].QuestionFilter = "Saturday, Sunday"
For a grid that displays weekdays only, type:
TimesEaten[..].QuestionFilter = "Monday..Friday"
Both example use [..] to apply the specification to all repetitions. Without this, the interviewing program assumes that the statement refers to repetitions rather than questions, and the interview will fail when it reads values that refer to questions. You can use this fact to your advantage if you want to filter on repetitions rather than questions. For example:
TimesEaten.QuestionFilter = "Fruit, Salads"
produces a grid with rows for fruit and salads only and columns for all days of the week. For more information on this aspect of loop filtering, see
Filtering the repetitions of loops with categorical control lists.
See also