IdCode: display conditions

Compatibilità: IdSurvey 6 IdSurvey 7

In this article you will learn how to design display conditions with IdCode programming language.

To write the questionnaire of your survey with IdCode you can:

  • click on “Import from script”, if you’ve just created your survey and it’s the first time you open “Questions” section. If you’re importing a code from version 6 into version 7, please use the “import from IdSurvey 6” button, then proceed normally.
  • click on the gearwheel button of the pages box and then on “IdCode – Display script” if you want to work on the code of the entire questionnaire.
  • click on the “IdCode” button you find on the top part of each page to work on the code of a single page.

 

Display conditions influence and lead the interview path and they are used to set when an item of the questionnaire has to be displayed to the respondent.

Display conditions can be inserted in IdCode after any item (sections, pages, group of questions, questions, answers, rows and columns) written in quotation marks and preceded by /F. For example /F "if(Q1==1)"

If correctly written, display conditions are displayed in orange in IdCode.idcode_display

Note

  • For a quick check on display condition coherence and consistency click on the gearwheel button of pages box tools then on “Filter & Logic Control” and run a first check on what you wrote.  Make sure you wrote the symbols correctly, you used parenthesis to specify the order and priority of the instructions and you closed the instruction(s) with round brackets.

Comparison symbols that you can use to write your display condition are:

  • = = equal
  • != different
  • < less than
  • > greater than
  • <= less than or equal to
  • >= greater than or equal to

 

Here’s some of the display conditions you can set next to any item of your questionnaire:

Display if I answered with a specific option

Syntax:

if (‘question code’ ‘comparison symbol’ ‘answer code number’)

Example:

if (a01==02)

Display if I answered with specific options in different questions

Syntax:

if (‘question code’ ‘comparison symbol’ ‘answer code number’ ‘logical operator’ ‘second question code’ ‘comparison symbol’ ‘answer code number’…)

Example:

if(a10==01||a11==01)

if( (a01==98||a01==99)&&b3==01)

if( (a01==01||a01==02)&&(b3==01||b5==12))

Display if I answered an open end question with a specific value

With this codification you check the open end answer given to a question. To do this you have to write code of the question between square brackets.

Syntax:

If(‘[question code between square brackets]’ ‘comparison symbol’ ‘numerical value’)

Example:

if([a03]>19)

Display if at question a03 I wrote a number greater than 19.

Display if a contact field contains a specific value

It is possible to control the value of a field (e.g.: gender) in the contact database. In this case you have to put the name of the field between curly brackets.

Example:

if({gender}==M)

Display if gender is male.

 

Leave A Comment?