IdCode: an introduction

Compatibility:IdSurvey 7IdSurvey 8

IdCode is the questionnaire in script format. It has a simple but powerful syntax that you can use to quickly create pages, questions, answer options, etc.
IdCode works in parallel with the graphical user interface so you can access to the code from any page in just one click.

For other articles related to it, please go to the “IdCode” section of this knowledge base.

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

  • click on “Import from script”, if you have just created your survey and it is the first time you open “Questions” section
  • 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 “IdC” button you find on the top part of each page to work on the code of a single page

 

With IdCode you can copy and paste parts of the questionnaire to create similar questions or pages with one click.

Programming with IdCode is quick and easy. Each object of the questionnaire has a specific color and codification. If the object is not correctly formatted, it will not be displayed in its corresponding color. If one object is displayed in light grey with red dots it means that the code of the object is not accepted by IdSurvey (for example, if the code of the page contains spaces or if you use the same code for two questions in the same questionnaire).

Let’s have a look at the colors and codifications of each object of the questionnaire.

IdCode example

Section

Section codifications are displayed in green. The section has to be opened before the first page included and closed after last page included.

To open a section you use codification: /section codeofthesection (e.g. SEC1)
To close a section you use codification: /endsection

Page

Page codification is displayed in light blue. Unlike sections, pages only need to be opened. If a page is contained in a section, leave an empty line between the section and the code of the page.

To open the page you use codification: /page codeofthepage (e.g. P1)

Note

  • When writing the page codes we follow this rule: we use “P” to indicate the pages + code of the first question contained in the page. For example, in page P1 the first question would be the one with code “1”. This is the naming convention that you will find in this Knowledge Base, but you can use any convention you like.

Group of questions

Groups are displayed in brick red. Group of questions have to be opened before the first question (included) and closed after the last question (included). Leave one empty line between page and group code and between group and question code. 

To open a group use the codification as follows: /group codeofthegroup (e.g. G1)
To close a group use the codification as follows: /endgroup

Questions

Questions are displayed in violet. Questions only have to be opened. Leave one empty line between the page and the question code and between question and answer codes.

To create a question leave an empty line after the page code then directly write question code (e.g. Q1). Then start a new paragraph to write the text of the question.
To create answer options leave an empty line between question text and first option. Answer options codes are displayed in blue.

You can specify in the code the type of question you want to create. You have to write the codification near question code after a dash sign and greater than sign (->).

  • single (default) e.g. Q3 ->s (or no codification)
  • multiple e.g. Q3 ->M
  • exclusive e.g. Q3 ->E
  • text (open end) e.g. Q3 ->T
  • long text (multiline) e.g. Q3 ->TM

Answers

Answer options of simple questions are displayed in blue. Simply write them in line below the question text leaving one empty space between question text and first answer option.
You have to write code of the option and text of the answer all in the same line.

You can specify different types of options also for a single answer using the same codification you use for questions.

  • single (default) e.g. Q3 ->s (or no codification)
  • multiple e.g. Q3 ->M
  • exclusive e.g. Q3 ->E
  • text (open end) e.g. Q3 ->T
  • long text (multiline) e.g. Q3 ->TM

Grid/Matrix

To create a grid question leave an empty line after the page code then directly write question code (e.g. Q1). Then start a new paragraph to write the text of the question.
Differently than simple questions, grids have rows and columns. Rows are displayed in violet, columns are displayed in blue.

To create rows leave an empty line after question text then write rows codification: /rows
Go to a new paragraph and write in line all rows text as follow: .codeoftherow text of the row (we suggest to use .1,.2,.3,.4 etc. for rows codes)

Nota

  • It is essential to write the full stop before the code of the row in order to ensure the correct functioning of any filters that recall elements of the matrix.

To create columns go to a new paragraph right below last column text and write columns codification: /cols
Go to a new paragraph and write in line all colums text as follow: codeofthecolumns text of the row

As for simple questions, you can specify the type of grid you want to create. You have to write the codification near question code after a dash sign and greater than sign (->).

  • single (default) e.g. Q3 ->s (or no codification)
  • multiple e.g. Q3 ->M
  • exclusive e.g. Q3 ->m
  • text (open end) e.g. Q3 ->T
  • long text (multiline) e.g. Q3 ->TM

To manage exceptions on single cells (one or more cell with different settings like type or logic condition) you have to use the instruction /cells and specify which cell (concatenation row code and column code) has to have different characteristics.

3D Grid/Matrix

To create a 3D matrix question leave an empty line after the page code then directly write question code (e.g. Q1). Then start a new paragraph to write the text of the question.

Differently than simple matrixes, 3D matrixes have rows, columns and cell templates. Rows are displayed in violet, columns are displayed in violet also, cell templates are displayed in blue.

If you specify just one cell template, it will be applied by default to all columns. If you insert more than one cell template you should write the codification near the column text you want the template to be applied (see pic below). All columns with no specification will have celltemplate 1 applied by default.

To create cell template leave an empty line after question text then write codification: /celltemplate code (e.g. /celltemplate 1)
Then go to a new paragraph and write the settings you want applied to an entire column.

To create rows go to a new paragraph then write rows codification: /rows
Go to a new paragraph and write in line all rows text as follow: .codeoftherow text of the row (we suggest to use .1,.2,.3,.4 etc. for rows codes)

To create columns go to a new paragraph right below last colum text and write columns codification: /cols
Go to a new paragraph and write all colums text in line as follows: .codeofthecolumns text of the column

Nota

  • Although it is not mandatory to use the full stop in the codes of rows and columns of 3D matrixes, it is essential to write the full stop before the code in order to ensure the correct functioning of any filters that recall elements of the 3D matrix, for example Q1.1.1 will recall Question1, row1, column1.

To manage exceptions on single cells (one or more cells with different settings like type or logic condition) you have to use the instruction /cells and specify which cell (concatenation row code and column code) has to have different characteristics.

  • single (default) e.g. Q3 ->s (or no codification)
  • multiple e.g. Q3 ->M
  • mono (exclusive) e.g. Q3 ->m
  • text (open end) e.g. Q3 ->T
  • long text (multiline) e.g. Q3 ->TM

Leave A Comment?