"would you like to respond to another scenario?": allow respondents to choose to see another randomly selected scenario | XM Community
Skip to main content

good afternoon! I’m setting up a survey that seeks responses to a set of scenarios. I want to randomly present one of eight scenarios and ask five questions about it. Then, I want to give respondents the option to EITHER answer the same five questions about a second randomly selected scenario OR to finish the survey. If they respond to the second one, they’d have an option to respond to a third, and so on, until they decide to stop or all eight scenarios have been seen. 

I found this post which I think may describe what I need to do, but as a new user I am not entirely sure how to achieve what is described. 

Thank you so much to the community for any help!

@jaredi,

You’ll need to use a Loop & Merge block and some JavaScript (JS) to set embedded data fields. Each loop will be a scenario.

> Before the block set the embedded data fields currentLoop=0 and endLoop=0 in the survey flow.

> Make the first question in the loop “Do you want to answer another scenario?” with the choices Yes and No. Add display logic to only display if currentLoop>0 and endLoop=0. Add JS (The choice id of No=2):

Qualtrics.SurveyEngine.addOnPageSubmit(function() {
if(this.getSelectedChoices()i0]=="2") Qualtrics.SurveyEngine.setEmbeddedData("endLoop","1");
});

> Add a page break after the first question 

> Add JS to the next question:

Qualtrics.SurveyEngine.addOnload(function() {
Qualtrics.SurveyEngine.setEmbeddedData("currentLoop","${lm://CurrentLoopNumber}");
});

> Add display logic endLoop=0 to all questions in the loop after the first one.


thank you so much @TomG for your quick response! I’m working on setting this up as you’ve described, but am not sure where the scenarios themselves should go. Each scenario is a title, an image and a paragraph of text. Would these each be placed in a separate block and randomised? 


The scenarios will go in the loop & merge fields. Field 1: name, Field 2: image url, Field 3: paragraph. Then pipe the loop and merge fields (e.g., ${e://Field/1} into your questions.


It worked! I’m really grateful for your help @TomG . There are two final things I can’t work out, if you or anyone are able to advise.

  1. The display logic is working perfectly if respondents say ‘yes’, but I can’t figure out how to get the survey to go to the next block if they say ‘no’. 
  2. Is there a way for the first randomised scenario to appear automatically, with the questions, and the “Do you want to answer another scenario?” question only to appear after the first scenario is responded to? It’s not such a big problem if not, I think I can come up with wording that will make it clear.

Thank you again!


  1. The display logic is working perfectly if respondents say ‘yes’, but I can’t figure out how to get the survey to go to the next block if they say ‘no’. 

If you’ve set the embedded data field endLoop correctly, it should skip all the remaining question in the loop & merge block and go to the next block

  1. Is there a way for the first randomised scenario to appear automatically, with the questions, and the “Do you want to answer another scenario?” question only to appear after the first scenario is responded to? It’s not such a big problem if not, I think I can come up with wording that will make it clear.

If you’ve set the embedded data fields and display logic as described, the “Do you want to answer another scenario?” will not appear for the first scenario.


I went back through everything again from your first response, step by step, and both the remaining issues are resolved. Thanks so much! 


Leave a Reply