1. Home
  2. Other Resources
  3. Tipps & Tricks
  4. Value Assignment: How can I use it?

Value Assignment: How can I use it?

value assignment survey element

The Value Assignment element is a very powerful tool for complex surveys. This also means it’s quote complicated to explain! To do this, we’ve created four examples of how to use it.

Use Case 1: Placeholder for RankOrder First Rank
Rank Order

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:

  1. Create a text variable (in this example we’ll call it ‘rank_one’)
  2. Create one value assignment for each element of your rank order question
    1. The setting should be ‘Execute everytime the participant passes this point’
    2. The value of ‘rank_one’ should be set to the label of the corresponding element
    3. The filter should be set to: Execute only if the corresponding element has rank one
filters on value assignments

Now you can use the placeholder {{custom.rank_one}} for a question such as ‘Why did you choose {{custom.rank_one}} as rank one?’

placeholder of custom variable

Use Case 2: Random Number

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:

value assignment
  1. Create a number variable (in this example we’ll call it ‘random_number’)
  2. Create a value assignment
    1. The setting should be ‘Execute only once the participant reaches this point’
    2. The value of ‘random_number’ should be set to {{function.randbetween(1,4)}} (this function will create a random number between 1 and 4)
survey preview

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′.

Use Case 3: Test Calculation

Question

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):

test calculation
  1. one value assignment to set the variable to 0 (which happens when the participant passes this element)
  2. 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. To sum variables we’ll need to use placeholders. For example: {{pq1}}+{{pq2}}+{{pq3}}…etc.

test calculation
  1. a filtered value assignment which sets the value to the sum of all points; the setting should be ‘every time the participant passes this element’.

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.

Use Case 4: Saving comlplex filters

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:

value assignments complex filters
  1. one value assignment to set the variable (let’s call it ‘complex_filter’) to 0 (which happens whenever the participant passes this element)
  2. a filtered value assignment which sets the value to 1; the setting should be ‘everytime the participant passes this element’.
    1. The Filter to set is your complex filter
easy 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.

Updated on August 26, 2019

Was this article helpful?

Related Articles