How to display only one unselected choice using piped text? | XM Community
Question

How to display only one unselected choice using piped text?

  • 18 April 2019
  • 4 replies
  • 271 views

Hi,

In my study, I'm asking participants to select one option out of three - "Option 1", "Option 2" and "Neither". I have two conditions. One is "aligned" and will display a question with the option participants selected. Second is "misaligned" and should also display only ONE unselected choice - but either "Option 1" or "Option2" (depending on what they selected), *but never "Neither"*. I tried to use piped text, but both unselected choices are still displayed.

Is there a way around it?

Thank you!
Alina

4 replies

Userlevel 7
Badge +33
Instead of piped text, show both options in both questions and apply display logic on answer options. In first question if selected and in second question if not selcted.
something like below

!
Userlevel 7
Badge +33
While if you are looking to display selected and unselected choice except none you have to split the unselected choices pipe text. As selected will give only one option while unselected will always display option and none. You can write java script to break the text like below-

`Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
var rank= "${q://QID48/ChoiceGroup/UnselectedChoices}}";

var rank_split=rank.split(",");

var Rank_1 = rank_split[0];


Qualtrics.SurveyEngine.setEmbeddedData( 'Reason_1', Rank_1 );

});`

Add this code in question after your main question and give page break after these questions and create embeded variable `"Reason_1" in survey flow. And than pipe this embed variable in your question. Your questions will look like below:-
!

Hi PeeyushBansal This is very helpful!
I am almost there, but the embedded text isn't appearing in my second question. I think perhaps I have not set up the embedded field correctly.
I added this at the beginning of the survey.
image.png
And this is what I have in the question. I have this for the question where the various sweet items are displayed, and would like to create embedded data for 5 of these items.
image.png
Where am I going wrong?
Thank you in advance!!

Badge

I was wondering if you can share the solution? I used the same method above and I also can't seem to see the embedded text...

Leave a Reply