Increasing/Decreasing a number by 1, within a range of numbers (1-6)? | XM Community
Skip to main content

I need help coding a complicated way to assign tasks to participants in an experiment administered via Qualtrics.
Problem:
I'm creating a survey which requires participants to do a task x number of times, and then do that same task again for y number of times.
x = a random number between 1 and 6
y = x+1 or x-1, but cannot exceed 6 or be less than 1
I am able to generate a random number for x (using metadata to create a random number and then assigning that as an embedded data field) However, I cannot figure out how to make y work. I know it is possible to to use Math Operations in Embedded Data, but I don't know how to restrict the operation to a range of numbers (1 - 6).
Request:
Does anybody know of a way to make this concept of y work in Qualtrics? It's a bit beyond my current capabilities. Thanks 😀

Make

 y = x + 1
then add a branch with the condition
x = 6
. In this branch, make
y = 5
. Now you'll have the following set of values:
  • x = 1, y = 2

  • x = 2, y = 3

  • x = 3, y = 4

  • x = 4, y = 5

  • x = 5, y = 6

  • x = 6, y = 5


Thanks! Does this solution require Javascript, or just embedded data and math operators?


Leave a Reply