How to customize piped text | XM Community
Solved

How to customize piped text

  • 4 September 2018
  • 13 replies
  • 60 views

I'm working on a survey that has a multiple choice question with the following response categories:

* Conserve the local environment (e.g., conservation easements, land acquisition)
* Manage or take care of a place in the local environment (e.g., a community garden, a block of street trees, an empty lot, a riverbank, a schoolyard, a forest preserve)
* Transform or restore the local environment (e.g., daylighting a stream, brownfield to prairie restorations, urban trees, green infrastructure)
* Monitor changes in the local environment (e.g., air or water quality, dumping, or species monitoring, remote sensing, urban heat, shade, soil)
* Advocate for the local environment
* Educate the public about the local environment
* No, My organization does not do any of these stewardship activities.

I want to take the responses to this question and pipe them in other questions; however, I don't want the full answer category. For example, I want "Conserve the local environment (e.g., conservation easements, land acquisition)" to show up as "conservation" in a piped text. Is this possible?
icon

Best answer by Anonymous 4 September 2018, 19:20

View original

13 replies

Hello @cdonovan ,

You can acheive this by branch logic in survey flow i.e you can set condition that if "Conserve the local environment (e.g., conservation easements, land acquisition)" is selected then set Embedded data(temp) in the survey flow as "conserve" and then keep concatenating based on branch logic as " ${e://Field/temp}, Manage" if "Manage or take care of a place in the local environment (e.g., a community garden, a block of street trees, an empty lot, a riverbank, a schoolyard, a forest preserve)" is selected and so on. Hope you get the implementation.
So I've tried to add branch logic in survey flow and then insert piped text in the following question, and nothing shows up.

See branch logic.
!

Then see inserted piped text. When I preview the survey and fill out this question, nothing populates.

!
Userlevel 7
Badge +33
You have to place these embedded variables in survey flow at start or before the question where you are piping these.
Userlevel 7
Badge +20
@cdonovan

Can you please check if the question in which you are trying to insert the pipe-text is coming after all branch logic (after assigning value to embedded data)

Also, you are not concatenating the response in your embedded data...

so, for education branch logic the embedded data value will be
Stewardship = ${e://Field/Stewardship}, education

likewise, for conserve, the value will be
Stewardship = ${e://Field/Stewardship}, conservation
Ok, I think I'm getting closer. I updated the branching in Q1 such that the embedded data value is ${e://Field/Stewardship}, conservation or ${e://Field/Stewardship}, education or ${e://Field/Stewardship}, advocacy.

For the next question, Q2, (see wording below), it still does not generate any text.

Is the ${e://Field/Stewardship} work your organization does specific to an individual location or site, specific to a particular topic, or both?
Hello @cdonovan ,

Here's the QSF file with implementation
Userlevel 7
Badge +38
Here's your file @Shashi. It's working when I test. But your Q1 is multiple choice. The value in Q2 will automatically set to the last one in the flow. You should think if Q1 is supposed to be single response. Or if you need to store all short versions then you will want embedded data values

Stewardship1
Stewardship2
Stewardship3...
Hi @bstrahin,

Q1 is a select all that apply. Does the qsf file you provide work with that setup?
Userlevel 7
Badge +38
This will let you follow-up with a question per selected option in Q1.
Userlevel 7
Badge +27
There is a more flexible approach that will allow you to pipe in the same block (e.g., loop & merge) and support translations.

Build both long and short text into your original choices. Then show one and hide the other. For example, if the default is to show the long one and hide the short one:
```
<span class="long">Conserve the local environment (e.g., conservation easements, land acquisition)</span><span class="short" style="display:none">conservation</span>
```
and so on...

Then you just pipe the choices as needed, and when you want the short versions to show, just add this JavaScript to the question:
```
Qualtrics.SurveyEngine.addOnload(function() {
var q = jQuery("#"+this.questionId);
q.find(".long").hide();
q.find(".short").show();
});
```
So, I have this exact survey flow, and for some reason it still won't work for me. See the screen shots below.

!

!

!

When I test the survey in preview mode and select that advocacy response in Q1, the "advocacy" text does not appear in Q14. Nothing appears. What else am I missing?
@TomG
Where do I add the JavaScript? The question is "Is the [insert piped text short version] work your organization does specific to an individual location or site, specific to a particular topic, or both?"
Userlevel 7
Badge +7
> @cdonovan said:
> @TomG
> Where do I add the JavaScript? The question is "Is the [insert piped text short version] work your organization does specific to an individual location or site, specific to a particular topic, or both?"

That JavaScript would be added to the JavaScript editor of the question you are piping your answers into.

Leave a Reply