Complicates randomization of Survey flow with Javascript (or another way) | XM Community
Skip to main content
Hi all,

I need to perform quite complicated randomization in my survey. Specifically, I have two types of questions, and each type has 18 different questions. I want the participant to get only 6 questions- exactly 3 of each type. the order of the questions needs to be randomized as well.

It is pretty easy to do it with a code but seems impossible to me using the default qualtrics randomizer.



Is there a way to add java code (or any other code) to the randomization of the survey flow itself?



Thank you very much,

Lior
Hi @Lior123,

I don't know whether you can influence survey flow, but I think you could do following:



1) Select 3 statements from each category, put them to one array and randomize the order.

2) Make a new block and turn on "Loop & merge" and set count of loops to 6. In the block should be 2 questions, one of each type. Both question should be hidden by default CSS.

3) In JavaScript of these question select the proper element using the current loop number and show the question of the category where the element belongs. In case the aren't easily distinguishable, you could add some mark (e.g.: @) to the beginning or the end of the strings of one category before the first step.

4) Show the statements in the text of your question using innerHTML property. Remove the mark before this if you use it.
Thank you for the detailed response!

My problem is that I have many possible combinations of 3 statements from each category, so I am not sure the first stage can work, but I will try it anyway.
Hi @Lior123,

the number of your statements shouldn't matter. Where do you see the potential problem with this? Try to look at this discussion. I heven't tried any of the solutions, but they have many up-votes.

Good luck with your survey!
You could just set this up with a Randomizer for each type, then create an embedded data counter for the 18 questions. Have the randomizer only select 3 of the 18 with evenly present. Then you could add branch logic or display logic to the questions if needed.

Leave a Reply