Display an item according to the number of answers previously selected

Compatibility: IdSurvey 6 IdSurvey 7

Sometimes it might be necessary to display an item according to the number of answers previously selected in a multiple choice question.

Instructions

Write the “CountCode” function in the Display Condition GUI box of the page:
if(CountCode (Question Code) == Number of options)

If you want to set it in the IdCode, write the code as follows:
/F "if(CountCode (Question Code) == Number of options)"

You can set the condition for as many options as you want.

Note

  • IdSurvey 6 uses a different syntax from version 7, since you do not need to enclose the Question Code within round brackets. Please refer to the breaking changes article for further informations.

Example

In question “Q1” I want to ask which product(s) from a specific brand the interviewer would purchase first. I want page “P2” to appear only if only one option in question “Q1” was selected.

In the gearwheel button of page “P2” I will set following filter: if(CountCode (Q1) ==1)

The entire IdCode is as follows:

/page 1

P1 ->M

Which product(s) from Brand X would you buy first?
1 product 1
2 product 2
3 product 3
4 product 4
5 product 5
6 product 6
7 product 7
8 product 8

/page P2 /F "if(CountCode (Q1)==1)"

Q2
Would you consider buying any other product?

1 product 1 /F "if(Q1!=1)"
2 product 2 /F "if(Q1!=2)"
3 product 3 /F "if(Q1!=3)"
4 product 4 /F "if(Q1!=4)"
5 product 5 /F "if(Q1!=5)"
6 product 6 /F "if(Q1!=6)"
7 product 7 /F "if(Q1!=7)"
8 product 8 /F "if(Q1!=8)"

Leave A Comment?