Loop and Merge based on embedded variables | XM Community
Skip to main content
Is there some way to only show certain "Loop and Merge" fields based on embedded variables?



Here is what I am trying to do:

* We ask which months a respondent has traveled to a destination.

* Then we ask how many times in each month.

* Then we are asking questions about each individual trips per month in a loop.

So if they say they took 2 trips in May 2019, we will pipe in "your first May 2019 trip" and "your second May 2019 trip". If they only take 1 trip in May then we will pipe in "your May 2019 trip".



I am new to Qualtrics (used to use Confirmit). So my thought was that I could somehow set up JS (although I don't know enough about scripting to do this myself) to a hidden question and then use that hidden question to base the Loop off of. Is this possible?
That sounds a bit like a nested loop and merge, which unfortunately is not currently supported (as far as I know). You may be better off using math operations and branching logic but it could get pretty unwieldy.



BUT if you want to try this, you could use the Survey Flow to set variables such as Month = May and Times = 4, then If Times >= 1 then Modifier1 = "first", then pipe in text to say something like Your <Modifer1><Month> trip.
> @Jodi said:

> Is there some way to only show certain "Loop and Merge" fields based on embedded variables?

>

> Here is what I am trying to do:

> * We ask which months a respondent has traveled to a destination.

> * Then we ask how many times in each month.

> * Then we are asking questions about each individual trips per month in a loop.

> So if they say they took 2 trips in May 2019, we will pipe in "your first May 2019 trip" and "your second May 2019 trip". If they only take 1 trip in May then we will pipe in "your May 2019 trip".

>

> I am new to Qualtrics (used to use Confirmit). So my thought was that I could somehow set up JS (although I don't know enough about scripting to do this myself) to a hidden question and then use that hidden question to base the Loop off of. Is this possible?



You can base your loop off the "how many times in each month" question. Use html to put "first" inside a `<span>` tag, then pipe the total number of loops into JS and if it is one hide "first".

Leave a Reply