randomly present each participant 4 items from a pool of 44 items | XM Community
Skip to main content
Solved

randomly present each participant 4 items from a pool of 44 items

  • June 5, 2020
  • 6 replies
  • 52 views

Forum|alt.badge.img+1

Hi!
I have a survey in which I want to randomly assign each participant 4 items from a pool of 44 items, and then be able to pull the assigned items individually/separately (perhaps using piped text) to present them throughout the survey.
I haven't found any way to do this. My current partial solution is to create 4 separate randomizers with 11 items in each randomizer as embedded data and randomly present 1 item in each randomizer to present 4 items to each participant but this is not exactly what I want to accomplish.
Any ideas on how to accomplish this would be much appreciated, thanks!

Best answer by TomG

You could create a MC question with all 44 items and use Advanced Randomization to display 4 of the 44 evenly presented. Include JS to save the 4 displayed choices to embedded variables (item1, item2, etc.).
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" label.SingleAnswer > span").each(function(i) {
Qualtrics.SurveyEngine.setEmbeddedData("item"+(i+1),jQuery(this).html());
});
this.clickNextButton();
});

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • Answer
  • June 6, 2020

You could create a MC question with all 44 items and use Advanced Randomization to display 4 of the 44 evenly presented. Include JS to save the 4 displayed choices to embedded variables (item1, item2, etc.).
Qualtrics.SurveyEngine.addOnload(function() {
jQuery("#"+this.questionId+" label.SingleAnswer > span").each(function(i) {
Qualtrics.SurveyEngine.setEmbeddedData("item"+(i+1),jQuery(this).html());
});
this.clickNextButton();
});


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • June 6, 2020

Thanks very much Tom! This is very helpful. I tried implementing this but I am running into two problems. I am probabaly missing something obvious.
1) I tried retrieving the displayed choices using piped text in another question (see screenshot) but it does not appear to be working.
image.png2) when I preview the survey the question in which I added the javascript it advances automatically.
In case any of the details matter, this is the question that I added the javascript:
image.pngThanks again!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • June 6, 2020

Add the script to a single answer multiple choice(MC) question (you added it to Matrix). It should be on its own page.


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • June 6, 2020

Thank you so much, this works. It's amazing!
If I may ask one quick last question: is there any way to avoid presenting the MC question to participants (without interrupting what its supposed to be doing)?


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • June 6, 2020

It has to display. I would just put a lot of spacing at the top of the question text so they just see a blank page when it flashes by.


Question text


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • June 6, 2020

Great, thank you so much again. This was incredibly helpful.