Desktop User Guides > Professional > Interview scripting > Writing interview scripts > Filtering questions and response lists > Asking a subset of questions from a block, compound, or page
 
Asking a subset of questions from a block, compound, or page
Pages (see Displaying a list of questions on the same page), blocks (see Question blocks), and compounds (see Printing categorical items side by side) are all convenient and efficient ways of defining groups of related questions that need to be kept together in some way. The thing that they have in common is that the interviewing program sees each block, compound, or page as a single entity and expects to display all the questions in the group. This need not prevent you using these items if you do not always want to ask all questions in the group, as filtering gives you complete control over which questions are presented to each respondent.
For example, suppose you have a block of demographic questions about the respondent’s family. It contains questions about children, but you already know from a previous question that the respondent has no children. Rather than defining two versions of the block, or placing the child-related questions outside the block, you can define the block in the normal way and then specify in the routing section that the child-related questions should be suppressed if the respondent does not have children.
Syntax
You specify this sort of filtering in the routing section by typing:
Name.QuestionFilter = "SubQname1, ..., SubQnameN"
Parameters
Name
The name of the block, compound, or page.
SubQname1 to SubQnameN
The names of the subquestions you want to display.
Example
Here’s how to use it to set up the example. The block is defined in the metadata section as:
Demographics "Demographic Questions" block fields
(
Gender "Are you ...?" categorical [1..1]
{
Male,
Female,
NoAnswer "No answer" na
};
Age "How old are you?" long [18..99];
MaritalStatus "What is your marital status?"
      categorical [1..1]
{
Single,
Couple "Married/Living with partner",
Separated,
Divorced,
Widowed,
NoAnswer "No answer" na
};
NumberChildren "How many children are there in your
      household?"
long [0..9];
ChildAge "How old are those children?" categorical [1..]
{
Baby "Under 18 months",
Preschool "19 months to 5 years",
Child "5-12 years",
Teen "12-18 years",
Adult "18 years or older"
};
);
An earlier question called HasChildren (not shown here) tells you whether the respondent has children. To suppress the questions in the block about children, you place the following statements in the routing section:
If (HasChildren <> {Yes}) Then
  Demographics.QuestionFilter = "Gender, Age, MaritalStatus"
End If
Demographics.Ask()
See also
Filtering questions and response lists