Display condition with “different than”

Compatibility:IdSurvey 5IdSurvey 6

As we’ve seen in other articles of this Knowledge Base, IdSurvey can alter the normal flow of the questionnaire with Display conditions and Skip conditions. In this article we analyze Display conditions with the “different than” symbol.

object code != answer code

 

“Different than” let you display an object (a page, a question, an answer) just if the respondent DIDN’T select a specified answer in a previous question.

 

For example:

In question Q1 I have to select my favorite sport. The last option is “Don’t know” (code 99).

In the next page, question Q2 asks if you practice that sport.

To hide the page with question Q2 from those that selected “Don’t know” in question Q1, you have to set a display condition:

if(Q1!=99)

the page will be displayed only if the answer to question Q1 was “different than” 99 (“Don’t know”).

 

With this simple example it’s easy to see how using a “Different than” condition is much quicker than using “Equals to” as:

Q1==1 || Q1==2 || Q1==3 || Q1==4 || Q1==5 …

(the question will be displayed just if the answer to question Q1 was 1 or 2 or 3 or 4 or 5…)

Also, if we have to add other sport options to question Q1, we would have to add new options to the “Equals to” condition too.

 

As for any other symbol (equals to, greater than, less than, etc) you can create complex conditions with multiple values and parameters.

A common error

Sometimes you have to be careful when you use “Different than”. In particular when you are referring to an object that already has a condition. 

In fact a question that the respondent never answered (or that is never displayed to him) is always “different than”. 

If not specified, all questions are mandatory to answer and sequential. When you change the flow (using Display and Skip conditions) some questions may be never displayed by some respondents.

Let’s go back to the previous example: if in page of Q1 we set a display condition that display the question just to male respondents, then female respondents will never answer to the question.

In this case, the condition set in Q2 if(Q1!=99) is always true.

To avoid this issue you have to edit the condition of the page containing question Q2 by adding the condition set in question Q1:

if ({Gender} == M && Q1!=99)

the page will be displayed just if the respondent is a man and he DIDN’T select option 99 in question Q1.

 

When you’re using complex logic and conditions we suggest not to use “different than” and to prefer “equal to”, including all options apart from “don’t know”:

Q1==1 || Q1==2 || Q1==3 || Q1==4 || Q1==5

the page will be displayed only if you selected option 1 or 2 or 3 or 4 or 5, etc. in question Q1.

In this case female respondents (that won’t display nor answer question Q1) will never display the question Q2.

/page PGender

Gender
Please select:

1 Male /UQ “Gender=M”
2 Female /UQ “Gender=F”

/page PQ1 /F “if({Gender}==M)”

Q1
What’s your favorite sport?

1 Basketball
2 Soccer
3 Football
4 Baseball
5 Volleyball
98 Other ->T
99 Don’t know

/page PQ2 /F “if ({Gender}==M&&Q1!=99)”

Q2
Do you practice [Q1]?

1 Yes
2 No

 

For more information and example on Display Conditions check other articles of Logic and Filter Conditions in this knowledge base.

Leave A Comment?