pipe in text but exclude one option | XM Community
Skip to main content

I need to pipe in text of selected answers as a summary in the next question, but I need to exclude one of the options even if it is selected. Is this possible?

Hey ​@LauraS244 
i am sure there must be a solution using custom coding - Javascript but I gave it a try without it.

STEP 1 - Create your desired question multi choice question from where the selected choices will be picked. (example below)

I have kept it as ‘multi select’ - respondents can select more than one choice. 

STEP 2 - Create branch logics just after the question block.

I have created embedded data for each selected choice.

STEP 3 - Create a multi select embedded data which will comprise of all the above embedded data except the one you want to exclude.

“Fav_color” has values for 3 colors but not Blue (becuase i want exclude blue). Similary you can exclude your desired choice. The 3 values are comma separated, you can remove comma and keep it as is. Just play around and do some testing before finalising your approach.

STEP 4: Create a new summary question in a new block.

This pipe text will contain the multi select embedded data.

END!


Hi,

Here’s a solution with custom javascript.

  1. Add a hidden span with class “hideInSummary” to the choices you don’t want to display in the summary.
  1. Pipe in your results as usual in your summary question, but add this custom javascript code.
Qualtrics.SurveyEngine.addOnReady(function () {

document.querySelectorAll('span.hideInSummary').forEach(span => {
const prev = span.previousSibling;
if (prev && prev.nodeType === Node.TEXT_NODE) {
const content = prev.textContent;
if (content.endsWith(', ')) {
prev.textContent = content.replace(/, $/, '');
}
}
span.style.display = 'none';
});
});

 


Leave a Reply