Record loop order of Loop&Merge question

FovoLab
FovoLab CardiffCommunity Member Qubie ✭
edited July 13 in Custom Code

Hi everyone,

In my survey I set up 5 Loop&Merge fields, containing 8 images each. My survey logic will display only one Loop&Merge field to each participant. The issue is that I would like to present the 8 images of each Field in random order, but I also need to know the order in which each image is displayed. Unfortunately, Qualtrics does not export this information, is there a way I could access it?

Thanks so much for your help!

Best Answers

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    Accepted Answer

    From what I understand, you have set up loop and merge in a way that a person will see 8 images. The 4 other fields are meta data.

    If this is the case, then one way to go about it would be, to create an embedded variable which tracks the display order. Create a loop and merge field which is a unique identifier for each image. Something like Field 6 (img1, img2 ...). Add the following JS to the loop and merge question:

    Qualtrics.SurveyEngine.addOnReady(function()
    {
        var_name = "${lm://Field/6}" + "_display_order";
        Qualtrics.SurveyEngine.setEmbeddedData(var_name,"${lm://CurrentLoopNumber}");
    });
    

    This will create 8 embedded variables with names (img1_display_order, img2_display_order etc.). Their values will be from 1 to 8 indicating when the order in which they were displayed to the participants.

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    Accepted Answer

    Okay. So then you are doing it wrong.

    Don't create 5 fields, create 5 blocks. Each containing 8 images of the loop and merge set. But these blocks in a randomizer and select to display only one.

    Then run and see, you should get the desired results.

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭
    edited December 2020 Accepted Answer

    Here's a demo you can look at: https://iima.au1.qualtrics.com/jfe/preview/SV_0rBGUxfJtsfN70N?Q_CHL=preview&Q_SurveyVersionID=current

    Take it a few times and you'll see what I mean.

    And the attached QSF for your reference.


Answers

  • FovoLab
    FovoLab CardiffCommunity Member Qubie ✭

    Hi @ahmedA, thank you so much for your reply--I really appreciate it. Unfortunately, what you suggest did not solve my problem, but perhaps it is because I did not explain my issue correctly... I have 5 Fields in my Loop&Merge question. Each of these 5 Fields contains a different list of 8 images. I previously set up a display logic so that each participant will see only one Field-- corresponding to a list.

    Following your suggestion, I created an embedded data called 'var_name', added your script to the Loop&Merge question and created Field 6 identifying each variable. However, the 'var_name' column is empty in the export. Any suggestion about why this might be the case would be welcome!

  • FovoLab
    FovoLab CardiffCommunity Member Qubie ✭

    @ahmedA your demo works wonderfully! Thank you so much 🙏

  • JeanNicod
    JeanNicod Community Member Qubie ✭

    hello ahmedA !

    I am sorry to bring back this topic now, but I would like to create an embedded variable which tracks the display order, so I am trying to do the solution you proposed, but I am new to Qualtrics and I am struggling. Could you detail your solution ?

    In particular, what do you mean by "create a loop and merge field" ?

    I hope you will see this..

    Thanks a lot !