Loop & Merge with empty custom fields | XM Community
Skip to main content
Question

Loop & Merge with empty custom fields

  • January 27, 2024
  • 6 replies
  • 201 views

Forum|alt.badge.img+1

I have created a block with loop & merge that will go through only asking based on a previous questions selected answers. I edited the fields for the loop and merge to have them answer based on what they previously selected. However, not all questions in the loop have the same number of selections so how do I not show the empty fields.

 

For example, my Loop & Merge fields look like:

FIELD1, FIELD2, FIELD3, FIELD4

TitleA, opt1, opt2, opt3

TitleB, optA, optB

TitleC, optionA, optionB, optionC

TitleD, only

6 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • January 28, 2024

Add a display logic to the choice to display only if the field is not empty.


Forum|alt.badge.img+1
  • Author
  • 2 replies
  • January 28, 2024

Add a display logic to the choice to display only if the field is not empty.

Everything I try this, I can’t find the option for the field being empty. Where is that option?


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • January 28, 2024

share a screenshot of the options you are seeing and what you are doing.


Forum|alt.badge.img+1
  • Author
  • 2 replies
  • January 28, 2024

Here is what the fields in the Loop & Merge look like:

Then when going through the loop, the first three are fine, but the fourth one looks like:

 


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2050 replies
  • January 28, 2024

 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 6083 replies
  • January 28, 2024

Unfortunately, Qualtrics doesn’t let you add display logic based on loop & merge fields. 

I would hide the choices with JavaScript:

Qualtrics.SurveyEngine.addOnload(function() {
var fields = ["${lm://Field/2}","${lm://Field/3}","${lm://Field/4}","${lm://Field/5}"];
jQuery("#"+this.questionId+" .Selection").each(function(i) {
if(fields[i].length==0) jQuery(this).hide();
});
});