Random choices from a list, maintaining order | XM Community

Random choices from a list, maintaining order

  • 15 February 2023
  • 4 replies
  • 115 views

Badge +1

I have a list of 15 choices (say 1-15). I want to select 5 choices from this list at random to be displayed for Q1. and a separate 5 for Q2 (with no overlap).
Further, the display order must be preserved for both questions (if choices 1,3,4,7,8 were selected for q1, they should be displayed in that order and not as say 1,7,4,8,3). (So I cannot use advanced randomization).
I was thinking of using a randomizer to randomly set 5 out of 15 'flags' to 'on' and for Q1 display only those choices which have the corresponding flag=on.
What I am unable to do is for Q2 - how do I randomly select 5 of the 10 remaining choices to display for q2?
Any help would be appreciated - thanks!


4 replies

Userlevel 4
Badge +13

You will need 2 advance randomizer in survey flow, one for Q1 and next for Q2.
Now, for Q1, set flags to 1 for all 15 questions (being shown in the same block in order) and randomly pick 5 of them. Then show the block with those 15 questions in order and use logic to be shown only if it's value is 1.
Now for the second one, set all the 15 questions variables to 2 only if it's not 1. Example if Q1_1 (for first question) is not equal to 1 then set it 2 and so on for all 15 question flags. Then choose 5 from them randomly and again call the same block (duplicate the block in survey builder) and have logic to be shown only if it's value is 2.
This will solve your requirement but will have 2 data columns for the same question. But then you can merge the final data in a 3rd block from both these scenarios.

Badge +1

https://community.qualtrics.com/XMcommunity/discussion/comment/55510#Comment_55510Thanks for your reply Rahul. I am new to Qualtrics so did not fully understand your comment.
From what I understand, you say:

  1. Add a randomizer to survey flow to randomly pick 5 of the following 15: Set embedded data f1=1, f2=1,...,f15=1.

  2. Q1 - Display choice1 if f1=1,...display choice15 if f15=1. (So far is clear)

  3. Add another randomizer to select 5 of the following 15: Set embedded data f1=2 if f1 is not equal to 1, ... ,f15=2 if f15 is not equal to 1.

  4. Q2 - Display choice1 if f1=2,...display choice15 if f15=2

I have two issues in comprehending point 3 - first, how do I put a logical condition while setting a value to embedded data? Second, in the second randomizer, if say options 2,4,5,9,12 are randomly selected and of them 9 and 12 were already selected for Q1. Then only 2,4,5 will have their flags updated to 2. Then only three options will be displayed for Q2, whereas I want 5 options displayed?
Thanks again!

Userlevel 7
Badge +27

For Q1, I would use the Advanced Randomizer to display a random subset then some JS to reorder the choices into order.
For Q2, I would carry forward the non-displayed choices, use the Advanced Randomizer to display a random subset, then the same JS to reorder the choices into order.

Userlevel 4
Badge +13

ms15 Randomizer will only pick the conditions whose conditions are met. So rest assured it will only pick the rest of the 10 questions.

Leave a Reply