Loop and merge (skip loop if embedded / merged data is blank) | XM Community
Question

Loop and merge (skip loop if embedded / merged data is blank)

  • 1 May 2024
  • 1 reply
  • 13 views

Badge

Hi,

I am asking users to listen to a song and then answer a few questions about it.

There are 100s of songs so I am using the loop and merge function to insert the song details for each loop. The data is in this kind of format - song details are in embedded fields + stored in the directory.


This means I need a variable number of loops, based on the song count. Or for the loop and merge cycle to stop once it reaches an empty field.  

 

Is there a way to do this?
 

Thank you!

 


1 reply

Userlevel 7
Badge +27

You’ll want to base the loop off a question.  There are a couple of ways you could do it:

  1. Add a text entry question before the loop, make the default answer ‘Total Songs’, and hide the question with JS. Base the loop off the question. Pipe the song names into the loop like you have already done. 
  2. Add a multiple choice question before the loop with the piped song names as choices. Add display logic to only display the choice if the pipe field is not empty, and hide the question with JS. Base the loop off the displayed choices.

Leave a Reply