Display conditions: And (&&) and Or (||)

Compatibility:IdSurvey 5IdSurvey 6

As we’ve seen in other articles of this Knowledge Base, IdSurvey can alter standard questionnaire flow with Display conditions and Skip conditions.

In this article we analyze Display conditions with “And” and “Or”.

Display condition with “And” (&&)

Display conditions with “And” symbol display an element of the questionnaire when all conditions with this symbol are simultaneously true. 
The symbol for conditions with “And”is: &&

An example:

I set in question Q4 this display condition


In this case question Q4 is displayed just if I selected answer with code “2” to question Q2 and answer “2” at question Q1 and answer “1” at question Q3.
If even one of those condition is not true, question Q4 won’t be displayed.
So if in question Q3 I select answer “3”, question Q4 won’t be displayed.

Display condition with “Or” ( || )

Display conditions with “Or”  symbol display an element of the questionnaire when at least one of the conditions with this symbol is true.
The symbol for conditions with is: ||

An example:

I set in question Q6 this display condition


In this case question Q6 is displayed if I select answer with code “2” to question Q4 or answer “2” to question Q5.
You need just one of the conditions specified to be true for question Q6 to be displayed.


As for all types of display conditions you can write complex filters with multiple conditions even with different symbols. To use this kind of complexity, you need to put conditions between brackets (you can’t mix different type of operators in the same bracket), as indicated in the following example:

if((Q1 == 2 && Q2 == 3) || (Q1 == 1 && Q2 == 4))
 is correct.

if(Q1 == 2 && Q2 == 3 || Q1 == 1 && Q2 == 4)
 is not.


if((Q1 == 2 || Q1 == 1) && (Q2 == 3 || Q2 == 4)) is correct.

if(Q1 == 2 || Q1 == 1 && Q2 == 3 || Q2 == 4) is not.

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

Leave A Comment?