Difficulty level: Difficult
What does the functionality do?
Suppose you want to know from each participant on which tasks they spent their working hours last week. This specified number of hours may not exceed the number of hours in the working week of the corresponding participant. In this case, you can avail yourself of the equals function.
Use case and how to set it up?
First, include an open question in the survey in which you ask for the number of working hours a week of the participant (Mandatory question). Under Response data type, you can set the Integer number criterion. Optionally, you can define a minimum (e.g. 24) and maximum value (e.g. 40).
You then create a matrix question in which each participant must enter the number of hours (defined as column) spent on each task (specified in the rows). This also concerns a mandatory question. The last row of the matrix question should then contain the automatically calculated, total number of hours that the corresponding participant has devoted to all listed tasks. In addition, you want this total number to be equal to the number of hours of the participant’s working week as specified in the first question.
Set the question type for all rows in the matrix question to Text. A participant can then enter the desired number of hours in the Hours column for all tasks.
Subsequently, you insert a value assignment prior to the matrix question. This element allows you to include a formula. At the Execute setting, you should select the Anytime (immediately after every change to an involved variable) option.
The value assignment formula in the figure above can be interpreted as follows: the total number of hours (q2_5_1) is automatically calculated by adding up the number of hours entered by a participant at the tasks in the rows Preparing a survey (q2_1_1), Designing a survey (q2_2_1), Distributing a survey (q2_3_1) AND Analysing a survey (q2_4_1).
Finally, you include a validation element in your survey after the matrix question to check whether the automatically calculated total in the Total row (q2_5_1) equals the number of working hours in question q1.
If you click on the inserted validation in the survey, you can register the error message and conditions on the right-hand side of the screen.
The error message is the message the participant will be presented with when he/she does not comply with the set condition(s). For example, if the corresponding participant has allocated more hours to the various tasks and consequently exceeds the total number of hours of his/her working week, this error message will be displayed. This participant will only be able to continue with the survey, after the total number of hours spent on tasks has been brought in line with the specified number of working hours in the week.
Once you have clicked the Edit conditions button, the Filter window appears where you can specify the condition(s) under which an error message is shown to a participant. In this example, this is when the total number of hours spent on tasks in a week differs from the total number of working hours in that week. You could set this up as follows:
- Show this validation message
- if – Calculation – equals(q1, q2_5_1) = false
After completing the setup, you still need to click the green Save changes button.