Question randomization for two different subsets | XM Community

Question randomization for two different subsets

  • 8 June 2023
  • 5 replies

Badge +2

Hey all! I need to set up a survey in a very specific way that I just can’t figure out how to do.

Here’s what I am trying to do: There are two different product categories (A and B) containing 6 products each. There is only one question where you can pick the one product you prefer. What should first be randomized is the choice set. You can either see all 6 products from both categories, 6 products from A and 2 from B, 2 products from A and 6 from B, or 2 from A and 2 from B - so it’s basically a 2x2 Matrix design. (6A,6B - 2A, 2B - 6A,2B - 2A - 6B). The products from both categories should be all on the same site and you’re only able to pick one product. Besides that, the order of the products in the final question should also be randomized. Should I create an MCQ with all 12 and start from there? Or two MCQs for both categories? I just can’t figure it out...
Any Idea how I can achieve that design? Thanks a lot in advance! 


Best answer by TomG 10 June 2023, 21:15

View original

5 replies

Userlevel 6
Badge +20

Hi @AlexDa 

Found few posts related to your questions


Badge +2

Hey @krbhavya - thanks for replying! 

I found some of them already but really didn’t make my survey work, unfortunately. What I am struggling the most with is the design with only 2 products from A and B - so only displaying a subset of both groups. 

Userlevel 4
Badge +16

Hello @AlexDa 

I think you can achieve this splitting the problem in three parts: 

  1. Firs of all you should have 4 different questions all of them with all the 12 options (6A + 6B). You can set the advanced randomization like this: 

    This is the example for 6A+2B. You can replicate this for 6A+6B (randomizing all choises) and 2A+6B (Randomizing choises for B and subset for A) in separate questions. I’m not sure how to achieve 2A+2B, but this can be a start. 

  2. You define in the survey flow a randomizer from 1 to 4 and then set display logics on each question based on the embedded data assigning each one possible option from 1 to 4.

  3. Last, for you to have all the responses in the same field, you can just create an embedded data that concatenates all the selected options from each question. 


Hope this helps at least to have a first version :)

Badge +2

Hey @Ricmarug 

Thanks for your help! 

But what I don’t quite understand. Why do I need Step 2 and 3? Wouldn’t it be enough to create 4 blocks (one for 2x6,6x2,6x6 & 2x2) and set a randomizer in survey flow to pick one of the four?

Besides, is there a way to completely randomize the order in the questions? The products within the categories are randomized, but the order of the categories (in the 2x6 and 6x2) is not, if I set it up in the “advanced randomization” tab, right? That’s what’s in the “Fixed Display Order” is?

Thanks again! Appreciate your help very much! 

Userlevel 7
Badge +27

@AlexDa ,

I don’t think Advanced Randomization is helpful for your requirement. JavaScript would be the easiest way to accomplish it. Show all 12 choices and randomize them. Put your choice labels in a span with a class so you know if they belong to A or B. For example:

<span class="A">A1</span>
<span class="B">B1</span>

Have the JS randomly hide 0 or 4 from each group:

Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery(this.questionContainer);
if(Math.random() < 0.5) { //Hide A?
q.find("span.A").slice(0,4).each(function() { jQuery(this).closest("li").hide(); });
if(Math.random() < 0.5) { //Hide B?
q.find("span.B").slice(0,4).each(function() { jQuery(this).closest("li").hide(); });


Leave a Reply