How to randomize large datasets?

LOBLOB Community Member Qubie ✭

How to randomize large datasets?

I would like to randomly assign to subjects 3 pictures from a dataset of over 100 pictures. I assume I can just embed each image as embedded data and randomize. However, since the dataset is large (100+ images) I was wondering if there is a simpler way to do this. Thanks!

Best Answer

  • SurajKSurajK IndiaCommunity Member Sage ✭✭✭
    edited June 25 Accepted Answer

    Actually there is one more way, you can add the images as a choice in multiple choice question and in Advance randomization, display randomly 3 choices, make sure to select evenly present checkbox and add the below code in JS, it will select the random 3 images.

    Create the 3 embedded data variables in the survey flow above the question, in the below code these are firstPicture, secondPicture and thirdPicture

    Qualtrics.SurveyEngine.addOnload(function()

    {

    /*Place your JavaScript here to run when the page loads*/

    jQuery('.QuestionOuter').css('display','none')

    });


    Qualtrics.SurveyEngine.addOnReady(function()

    {

    /*Place your JavaScript here to run when the page is fully displayed*/


    jQuery('input[type="checkbox"]').prop('checked',true)

    jQuery('#NextButton').click();

    });


    Qualtrics.SurveyEngine.addOnUnload(function()

    {

    /*Place your JavaScript here to run when the page is unloaded*/


    });


    Qualtrics.SurveyEngine.addOnPageSubmit(function(type)

    {

    if(type == "next")

    {

    var qid= this.questionId

    var firstimg = jQuery.trim(jQuery('#'+qid).find('.Selection').eq(0).text())

    Qualtrics.SurveyEngine.setEmbeddedData("firstPicture",firstimg)

    var secondimg = jQuery.trim(jQuery('#'+qid).find('.Selection').eq(1).text())

    Qualtrics.SurveyEngine.setEmbeddedData("secondPicture",secondimg)

    var thirdimg = jQuery.trim(jQuery('#'+qid).find('.Selection').eq(2).text())

    Qualtrics.SurveyEngine.setEmbeddedData("thirdPicture",thirdimg)


    }

    });

Answers

  • LOBLOB Community Member Qubie ✭
    edited June 25

    @SurajK thanks! but if I understand correctly, I would still have to manually upload all 100+ images as choices, correct? I was looking for a way to somehow upload all the images to qualtrics at once, and then randomly select one of those images in 3 separate questions (without replacement).

  • SurajKSurajK IndiaCommunity Member Sage ✭✭✭

    Yes, you will have to upload the images in Library and then you can add these as a choices.

Sign In to Comment