Overview
Expression questions are used for writing script's inside of them and\or returning values, for example:
"Calc the respondents points and return them" (Hidden text)
Question's Node
Under the Survey Tree, this is how the Question Node looks like.
The Tabs
Each question has a set of tabs; each tab is used for different configurations – let's go over the tabs.
The View Tab
In the view tab you can configure the basic components of a question, such as its body text and its answers.
Question Type & General Settings
In the main panel, you can set the questions type, its textual color and formatting.
In the bottom panel, you can Clear the questions content, add a new question of the same type right after the current one and quickly navigate between questions:
The 'Question' Tab
Under the question's tab, within the View tab, you can define the Questions Body Text and the surveyors instructions if any.
Defining The Questions Text
The text written in the question's tab box is the body text that will be displayed to the surveyor.
The surveyor instruction box, allows you to configure textual instructions for the surveyor that will be formatted differently than the body text.
* Please note that expression questions are not displayed to the surveyor – their text is used only for readability of the exported data and for the script writer.
The 'Answers' Tab
In the 'Answers' tab of an expression question you can write its script you want it to calculate and return a value.
For more information on how to write scripts in Expression questions please see the following tutorial's:
http://support.dooblo.net/entries/22818097-How-To-use-expression-questions
* Please note that an answer of an expression question in the exported data will be the value returned from its script in the 'Answers' tab.
The Rules Tab
In the rules tab you can define Entrance Rules, Validation Rules and Branching rules.
For more detail please see the following tutorials and refer to the scripting guide:
How to create Validation Rules
The Scripts Tab
This section is not relevant for expression question and can lead to unwanted behavior of the scripts in certain scenarios. In Expression question use only the Answers tab for the expression code.
The Variables Tab
The Variables Tab is used for configuring variable related properties of a question.
- Variable Name: is the name of the column representing this question when exporting.
- Missing Value: is the value that this question will get if it was not answered or skipped.
- Short ID: Is a short name that is used for ease of readability and is viewable in the Survey Tree next to the Question Index – Short ID's can also be used as a basis for variable names, please see: How to work with QRef's & Short ID's
Variable names can be referenced instead of Indexes by using the correct functions. (Basic Introduction to using VRef and VarName)
The Advanced Tab
The advanced tab allows you to set & configure more advanced properties of a question.
Please note that the expression question and the following question should be marked as 'Starts a New Page'
Variables and Exporting Definitions
If in the first interview my expression returned 3 and in the second interview it returned 5, this is how it will be exported:
Common Functions used to retrieve the value
These are some common functions used with this type of question:
Answer(QuestionIndex)
AnswerIter(QuestionIndex,IterationNumber)
Common Functions used to set the value
SetAnswer(QuestionIndex, AnswerIndex)
Related Links
For more functions please see the scripting guide and function library: Function Documentation
Comments
If I update the result of a specific question, which is used in an expression, will the result of the expression be recalculated?
Please sign in to leave a comment.