The Value Assignment element is a very powerful tool for complex surveys. This also means it’s quite complicated to explain! To do this, we’ve created four examples of how to use it.
For the element with the first rank in a rank order question, no placeholder exists. To get a placeholder for a later question we have to create it. To do this:
- Create a text variable (in this example we’ll call it ‘rank_one’)
- Create one value assignment for each element of your rank order question
- The setting should be ‘Execute everytime the participant passes this point’
- The value of ‘rank_one’ should be set to the label of the corresponding element
- The filter should be set to: Execute only if the corresponding element has rank one
Now you can use the placeholder {{custom.rank_one}} for a question such as ‘Why did you choose {{custom.rank_one}} as rank one?’
Let’s imagine you want to show one of four questions, but the question should be random. In this case it would be useful to have a random number created and stored.
To do this:
- Create a number variable (in this example we’ll call it ‘random_number’)
- Create a value assignment
- The setting should be ‘Execute only the first time the participant passes this point’
- The value of ‘random_number’ should be set to randomInt(1,5). This function will create a random number between 1 and 4 (the maximum value is excluded).
Now you can use this ‘random_number’ variable as the filter variable for the four questions. You should set a filter like: ‘Show this element if ‘random_number’ is equal to 1′.
Let’s imagine you want to use Survalyzer as a tool to conduct a test, for example, for a school class. On the final page you want to show the number of points scored, with a corresponding grade. For this to work, we need some preparation. For each question we will need to create an own number variable. We will also need to create two value assignments per question (only if the participant is allowed to go backwards):
- one value assignment to set the variable to 0 (which happens when the participant passes this element)
- a filtered value assignment which sets the value to the number of points the participant gets for this question; filtered to only assign this value if the question is answered correctly. The setting should be ‘everytime the participant passes this element’.
At the end of the survey we’ll create an additional variable, let’s call it ‘sum_points’, where we will store the sum of all question variables. For example: pq1+pq2+pq3…etc.
- a filtered value assignment which sets the value to the sum of all points; the setting should be ‘every time the participant passes this point’.
Now we have a sum of all points attained, stored in a variable. For each grade we now need to create a text block. Here we’ll use our ‘sum_points’ variable as a filter variable and placeholder, to show the number of points attained. Now we have a working test in place.
Sometimes you may need to set a complex filter several times at different places in your survey. There is a way to make this easier.
To do this you’ll need to create two value assignments (only if the participant is allowed to go backwards) directly after you gathered all necessary information for your complex filter:
- one value assignment to set the variable (let’s call it ‘complex_filter’) to 0 (which happens whenever the participant passes this element)
- a filtered value assignment which sets the value to 1; the setting should be ‘everytime the participant passes this element’.
- The Filter to set is your complex filter
Now you can simply use the filter ‘show this element if ‘complex_filter’ is equal to 1′. This is much easier to set than repeatedly creating a complex filter. Additionally, if you need to update the filter, you only have to change it in one place.