Randomize matrix statements using javascript based on embedded data value. | XM Community
Skip to main content

Randomize matrix statements using javascript based on embedded data value.

  • December 6, 2022
  • 4 replies
  • 29 views

Forum|alt.badge.img+1

Hi everyone,
I'm posting here for the first time and looking for a solution to a weird programming situation here.
I've a matrix question in my survey that needs statements randomization based on the value of embedded data. I couldn't find any native Qualtrics functionality to achieve that sort of randomization.
Context: We're basically trying to measure the impact on the scores of brand consideration if brands are listed top to bottom vs randomized.
I've Embedded data called "ABTest" where I'm piping random number (${rand://int/1:2}) and want the matrix statements to randomize if value is 2 and keep them fixed if the value is 1
Statements randomize.PNG

4 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • December 7, 2022

You could just create 2 questions one static and the other randomized. Then branch based on the random number you generate.


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • December 7, 2022

Thank you ahmedA for the suggestion. I proposed the same solution. However, we're making changes to an ongoing project and the data is being pulled in to the dashboards and we want to avoid the situation of adding one more question.


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • December 7, 2022

I was able to find the javascript that rotates the answer choices but I'm not sure how to do javascript for the statements randomization.


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • December 7, 2022

If you're using JS to rotate the statements, then make sure to use JS to record the randomization. Otherwise, you'll get garbage data.
Most things done using JS on client side is not sent to the server and therefore, not inline with the data stored in your responses.