Loop a question based on numerical answers to a previous question | XM Community
Skip to main content

I want to loop and merge a block (which includes only one question in the block) based on the answer to a previous question. So to illustrate, I will ask how many people fall under each ethnic category e.g,, Black, Asia, Other, Mixed, White etc. This question type is form field. I then want some code to read how many people would be classified as an ethnic minority group based on their answers, and loop the block to reflect how many are ethnic minorities so they can complete additional information. Does this make sense? Does the baseline question need to be a different question type e.g. constant sum?

You could set an embedded data variable to the sum of the fields that you're interested in, then use JavaScript to assign that value to a hidden question that will drive your number of loops. See this accepted answer for more information:
https://community.qualtrics.com/XMcommunity/discussion/6211/how-do-i-set-the-number-of-loops-in-a-loop-and-merge-based-on-an-embedded-data-object


Leave a Reply