Have you already seen Work:New.0 ? Tell us in a few words what you've learned from the video on the Community!

Answer Choice Randomization: Problem with randomized subset

edited June 2021 in Survey Platform

I have the following problem:
I want to include 15 single-choice answers (3 groups / 5 answers possibilities per group) in one question and the respondent should get only 1 randomly chosen answer from each group - in total 3 answers.
I tried with the 'Advanced Randomization' function, but I just managed to create one 'Random Subset'. So I need to create several 'Random Subsets' in one question.
Do you have any idea how to create more than one subset or how to solve the problem in another way, so that the respondents just get one answer from each group? I struggle with the problem for hours. So I really hope you can help me.

Many thanks in advance,

Best Answer

  • TomG
    TomG Raleigh, NC Wizard ✭✭✭✭✭
    edited April 2019 Accepted Answer


    To do it without JavaScript, you can use survey flow randomizers to randomly pick one choice from each group by setting flags for the choices to be shown. For example, let's say Group 1 is made up of Choices 1 through 5. Create a Group 1 randomizer with five embedded data blocks under it and randomly choose 1 block. The blocks would set a 'display' flag for each choice (e.g., choice1_flag = 1). Create a similar randomizer for each group. Then in your question add display logic to all your choices to only display the choice if the flag is set to 1.


  • WaterSampler
    WaterSampler Guru ✭✭

    You will probably have to do some javascript to achieve this.

    Create a question with all 15 answers to use as a base.

    In the javascript, make 3 random numbers to choose one from each group. Then hide the radio buttons for the non selected answers.

    Note that this will not change the order of the buttons, it will only hide the buttons. If you want a random order, you will have to randomize the order of all 15 answers and then use the random number to select a pointer to the answer location.

  • Unfortunately I'm not able to write a javascript code :-(

  • WaterSampler
    WaterSampler Guru ✭✭

    Is your keyboard broken?

    Seriously though, it is very easy to do this in Qualtrics. If you search the forum, there was a recent post on hiding the radio buttons. There are also many posts on randomizing.

    Off the top of my head, here is a starting point:
    var grp1 = [1, 4, 7, 10, 13]; // answer group 1 locations
    var grp2 = [2, 5, 8, 11, 14];
    var grp3 = [3, 6, 9, 12, 15];

    var pick1 = Math.floor((Math.random() * 5)); // random number between 0 and 4
    var pick2 = Math.floor((Math.random() * 5));
    var pick3 = Math.floor((Math.random() * 5));

    for (var i = 0; i < grp1.length; i++) {
    if (i <> pick1) {

    repeat the above code for grp2/pick2 and grp3/pick3.

    This should get you started.