Conditional Dynamic Texts

Compatibilità: IdSurvey 6 IdSurvey 7
X

Thanks to the dynamic text you can edit any text of the questionnaire according to one ore more conditions. This function is useful to manage singulars and plurals, masculine and feminine or to add notes to the interviewers that are not supposed to be displayed in the CAWI interview of the same survey.

The syntax for writing the dynamic text is as follows:

(condition) ? 'text1' : 'text2'

If the condition is true, write the expression 1. If not, write the expression 2. 

Example 1

In this example we ask how many cars does the respondent own. In the second one, we ask which is the car brand (in case the answer was ‘one’) or what is the brand of the car that he uses the most (in case the answer was ‘more than one’).

/page P1
Q1
How many cars do you own?
1 One
2 More than one

/page P2
Q2
What is the brand of  dynamic text ?

?
The dynamic text in question Q2 will change according to the answer given to question Q1. 

Step 1

Open the text editor of question Q2 and write the static text. Then click on the button.

Step 2

Write the condition and the two sentences that will be displayed.

(Q1==1) ? 'your car' : 'the car that you use the most'

If the answer to question Q1 is equal to 1, ‘your car’ will be displayed. Otherwise, ‘the car you use the most’.

Notes

  • Each string must be entered in between single quotation marks. If you need to write an apostrophe (or quotes) within the string, you need to put a \ (backlash) before it. By doing so, the quotes won’t be interpreted as end of the string.
  • It is important that the text ‘the car you use the most’ is always displayed if the condition is false. This means that if question Q1 was never asked because it was not mandatory or conditioned, Q1 would not be equal to 1, so the dynamic text to be displayed would always be ‘the car you use the most’.

Example 2

In this example we will see how to manage the dynamic text with more than one condition.

/page P1
Q1
Evaluate the product with a rating from 1 to 5?
1 Enter the rating (from 1 to 5) ->T /V "Ni,1:5"

/page P2
Q2
You expressed a rating   dynamic text , can you please tell us why?

The dynamic text in question Q2 will change according to the numeric answer given to question Q1. 

Step 1

Open the text editor of question Q2 and write the static text. Then click on the button.

Step 2

Write the condition and the two sentences that will be displayed.

( [Q1]>=4 ) ? 'positive' : ( [Q1]<=2 ) ? 'negative' : ( [Q1]==3 ) ? 'neutral' : ' '

If the numeric answer given to question Q1 is greater or equal to 4, ‘positive’ will be displayed. Otherwise, if lesser or equal to 2, ‘negative’ will be displayed. If equal to 3, ‘neutral’ will be displayed. Otherwise, nothing will be displayed. 

 

Note

  • It is important to note that the last condition is characterized by the last text expression empty (single quote – single quote with no content). The syntax requires that each condition should always have both the TRUE and FALSE expression. So even when the condition cannot be false in any case, it is necessary that the expression FALSE must be left empty.

Example 3

In this example we will use dynamic text to add a note that will only be displayed to the interviewers. The respondents of the CAWI interviews will not be able to see it.

/page P1
Q1
Hoe would you rate our service?   +  dynamic text  only visible to the operator 
1 Great
2 Adequate
3 Standard
4 Inadequate
5 Bad

The dynamic text in the body of the question should contain a note that will only be displayed to the interviewer: ‘Spontaneous answer, do not read the options’.

Step 1

Open the text editor of question Q2 and write the static text. Then click on the button.

Step 2

Write the condition and the two sentences that will be displayed.

( module()==CATI ) ? 'Spontaneous answer, do not read the options' : ''

If the interview is completed via CATI, the text ‘Spontaneous answer, do not read the options will be displayed. Otherwise, do not write anything.