Add Loop and Merge to a Reference Block | XM Community
Question

Add Loop and Merge to a Reference Block

  • 14 June 2023
  • 3 replies
  • 62 views

Userlevel 3
Badge +10
  • Level 3 ●●●
  • 35 replies

I have a complicated question I designed (with lots of Javascript and so on) which I will reuse many times in many different surveys. It would be nice if I can centralize it so that I can update it and the update automatically applies to all of the places I’ve used it in all of my surveys. For example, if I want to put out a survey now, and later rewrite the code to make it mobile friendly, I could change the design to be responsive in just one place, and now all that question in all my surveys would be responsive.

This seems like a perfect example of when I’d want to use a Reference Block. The problem is, I want to be able to present this question inside a loop and merge (i.e., I want the reference question to include ${lm://Field/1} in its text, with the loop and merge fields being survey specific), and I can’t figure out how to insert a reference block in such a way that it allows me to add a loop and merge in the target survey (rather than in the reference survey).

Is there a way to implement this? Or some other way to create a sort of “custom question type” that can be reused across surveys, and updated in only one place?


3 replies

Userlevel 7
Badge +33

If you want to apply loop and merge in the reference survey block then you will need to go to reference survey and edit that reference version. else you can redirect your survey from one place to another with help of JS and then bring back the respondent after completing that survey to here. In that case 2 different completes will be marked for one respondent.

Userlevel 3
Badge +10

If you want to apply loop and merge in the reference survey block then you will need to go to reference survey and edit that reference version. else you can redirect your survey from one place to another with help of JS and then bring back the respondent after completing that survey to here. In that case 2 different completes will be marked for one respondent.

 

I can’t add loop and merge in the reference block, because the values must come from the current survey. For example, in one survey I might want to run the reference block twelve times, once each for the lm values “January”, “February”, etc. In a different survey, I might want it to run four times, once each for the lm values “Winter”, “Spring”, etc.

I don’t think sending back and forth with JS would work in a loop and merge block either - this would not be 2 different completes as you say, it would be a variable number of repeats per subject (e.g., 12 completes in the months example above, and potentially hundreds in some of my use cases).

Userlevel 7
Badge +33

Try one thing. Add parameters with passing values to URL before moving to reference survey block and capture those value in reference survey’s survey flow using embedded field for further use.

Leave a Reply