Piping text based on which form text box was displayed | XM Community
Skip to main content

I have a survey where we ask if it was a trip to your home and the response is yes / no.

If yes, then the next page (a form) will show a field asking ‘Where did you go?’ and the default option of ‘home’ is entered. The ‘Where did you go? (including name of place/business if applicable)’ field is hidden, as is the ‘street address’ field and instead a ‘location description’ field is shown.

If no, then the ‘Where did you go?’ and the default option of ‘home’ is hidden and the ‘Where did you go? (including name of place/business if applicable)’ field is shown, with the ‘street address’ field also shown and the ‘location description’ field hidden.

This is because we don’t want to know respondent’s actual addresses, just an area, but if it is a business etc, then we want to know the address.

This works fine but when it comes to subsequent questions, we want to pipe in their answer to where they went, which, previously I did by adding “${q://QID56/ChoiceTextEntryValue/2}” where relevant. If they choose ‘home’ and then the default response of ‘home’ comes up, the other ‘where did you go question’ is hidden and remains blank. Then, if I pipe in “${q://QID56/ChoiceTextEntryValue/1}${q://QID56/ChoiceTextEntryValue/2}” where relevant, ‘home’ comes up.

BUT, if they had selected ‘no’ to home and that form field with the default option of ‘home’ is not displayed to them, they fill in the other ‘where did you go’ question (for example: “Woolworths”), then when the subsequent questions pipe in “${q://QID56/ChoiceTextEntryValue/1}${q://QID56/ChoiceTextEntryValue/2}” where relevant, ‘homeWoolworths’ comes up.

I understand why but is there a way to have the text piped in only from those fields displayed to the respondent?

This series of questions is repeated 10 times and the piping of the name of where they went throughout the survey. It would be nice if it was possible to make this work somehow? If not, I will just make the questions generic or say “type ‘home’ if you said you went home” or something clunky.

Many thanks for your help in advance!

 

Hello ​@KateD

In your Survey Flow, after the block where respondents answer the “Where did you go?” question, add an Embedded Data field (Destination) and pull in the piped text from the field that was shown to them. If they selected “home”, set 'Destination' to that response and if they selected “no”, set it to the other response. Next, use Branch Logic in the Survey Flow to assign the correct value to 'Destination' based on their answer to “Was it a trip to your home?”, if Yes, it takes the “home” value. if No, it takes the other value. After that, in later questions, you can simply pipe in ${e://Field/Destination} so that only the field the respondent actually saw and answered will appear.

Alternatively, you can directly use options that allow piping only the selected or displayed choice, which works well for matrix or multiple-choice questions.

Let me know if this helps.


You could have just one ‘Where did you go?’ entry and use JS to fill it in if QID55 is Yes. Then just pipe ${q://QID56/ChoiceTextEntryValue/1}.

HTML for label:

Where did you go?<span class="paren"> (including name of place/business if applicable)</span>

JS:

Qualtrics.SurveyEngine.addOnload(function() {
if("${q://QID55/ChoiceGroup/SelectedChoices}"=="Yes") {
this.setChoiceValue(1,"Home"); //assumes Where did you go? is choice 1
this.getQuestionContainer().querySelector(".paren").style.display = "none";
}
});

 


Thanks both for your answers! They both work but I like the simplicity of ​@TomG‘s solution, so have built this in.

Thanks again!!


Leave a Reply