Using piping to show given answers in follow-up questions
With piping, you can show given answers in a follow-up question. This means you automatically process a respondent's answer in a follow-up question. If the respondent, for example, answer 'Batman' to the question "Who's your favorite super hero?", then that answer will also be shown in the follow-up question "Why is Batman your favorite super hero?"
Piping can be done in 5 ways:
- Piping of single select questions
- Piping of multi-select questions
- Piping of the numeric values of answer options
- Piping of matrix questions
- Querystring piping
Piping of single-select questions
Single-select questions include single select, drop-down list, (multiline) textbox, rating scale, Net Promoter Score, slider, and date picker.
The most basic type is piping of questions where only one response is possible. This can be a selected answer option but also the answer to an open question.
The variables used in this case are {{respondent.questions.myDatalabelx}}, {{respondent.questions.myDatalabel}}, … where the data labels added in your questions can be used (e.g., movies, sports)
In the survey, this variable is replaced by the answer provided to the first, second, … question.
Example
When creating the survey, you add the variable {{respondent.questions.movie}} in the exact spot where the answer given to question 3 needs to be shown: "What genre is {{respondent.questions.movie}}?"
Piping of multi-select questions
Multi-select questions include multi-select, listbox, list of textboxes, rand ank order scale.
When using questions where more than one answer is possible, you'll need to be more specific and indicate which answer option out of the source question you want to show.
There are two possibilities:
Answer from 'Other, specify'
The variable {{respondent.questions.top3.openAnswer}} shows the answer given in the textbox from the "other, please specify" option. Say you ask your respondents to indicate the top three sports they've done the most this past year. You sum up five frequent sports, but you also provided a sixth option "other, please specify". Respondents can use this free text field to fill out a sport themselves.
In a follow-up question, you ask about the average frequency they performed these sports. Of course, you want to immediately show the sport that was filled out in the "other, please specify" option, without your respondents having to fill out the same sport again. After all, you already know the sport. They named it in the previous question. In that case, you use the variable {{respondent.questions.top3.openAnswer}}. 'The data label 'top3' stands for the question and 'openAnswer' for the answer option 'Other, please specify'.
In your survey, the variable will be replaced by the name of the sport provided in question 1.
It is used very often in combination with extraction whereby only the selected answers are shown in a follow-up question.
Specific answers from the multi-select question
The variable {{respondent.questions.drinks.answerChoices.nth-1}} returns the answer to the nth answer choice that the respondent selected (for instance, in a checkbox question and the respondent selects the 2nd and 5th answer choices, then 'nth-1' would be answer choice number 2 and 'nth-2' would be answer choice 5). Take, for example, the following question. A respondent selected three answers.
For this question, the data label "drinks" is used.
Next, you want to ask another question regarding these three answer options, but you don't know whether a particular respondent selected the 1st answer, the 3rd, or the last.
Using the variables {{respondent.questions.drinks.answerChoices.nth-1}} , {{respondent.questions.drinks.answerChoices.nth-2}}, and {{respondent.questions.drinks.answerChoices.nth-3}}, you will show the answers that were selected first, 2nd, and 3rd. In the above situation, they will respectively change into "Soft drinks", "Beer", and "Wine".
The following questions are about {{respondent.questions.1.answerChoices.nth-1}}
(Whereas {{respondent.questions.drinks.answerChoices.nth-1}} , {{respondent.questions.drinks.answerChoices.nth-2}} en {{respondent.questions.drinks.answerChoices.nth-3}} would have only shown "Water", "Soft drinks" and "Diet soft drinks".))
Piping of the numeric values of answer options
Numeric value questions include all question types but are used most often with rating scales.
When using a rating scale question type, you can add labels to each scale. You can, for example, add the label "very bad" to the number 1 and "very good" to number 10.
In the example below, the data label "satisfaction" is used for the question.
When using the variable {{respondent.questions.satisfaction.text}}, these labels would be shown in follow-up questions instead of the underlying, numeric, value.
To show these numeric scores, you should use instead the variable {{respondent.questions.satisfaction.scaleValue}}.
For example, you ask the following question:
This is also the very first question in your survey. Using the variable {{respondent.questions.satisfaction.scaleValue}}, you can show the number 1 through 10 in a follow-up question, depending on the answer option that was chosen.
Had you used the variable {{respondent.questions.satisfaction.scaleValue}}, the label "Extremely good" would have been shown, which isn't what you need in this case.
Piping of matrix questions
Matrix questions include all questions that fall under the Tables category.
This piping option uses a matrix as a source question.
In the example below, the data label "sports" is used for the question.
- {{survey.questions.sports.subQuestions.2}} shows the 2nd subquestion in question 6 with data label 'sports' from the example below.
- {{respondent.questions.sports.subQuestions.2}} shows the selected option for the 2nd sub-question in question 6 with data label 'sports' from the example below.
In this example, you want to investigate your respondents' sports activities and ask them to indicate their average weekly activity:
Now you want to know where people are going to exercise. You only ask this question when they actually are exercising, so using branching or page display logic, you can specify to only show this question when respondents exercise at least once per week.
The variable {{survey.questions.activities.answerchoices.1}} will change into the text label from the selected answer option. In this example, the text will change into 'more than 3 times a week'.
When you want to show the open answer that is given in the 'other' answer option, you can use this variable to show the open answer: {{respondent.questions.myLabel.subQuestions.1.openAnswer}}. x is the yth subsquestion.
Querystring piping
This form of piping doesn't show answers given to a specific question, but instead shows parameter values used in the survey URL.
Querystrings are the parts of the URL that come after the question mark '?'. Each query string is then separated by an ampersand '&'. When you use parameters to automatically fill out certain questions, you are actually adding query strings to your survey URL.
The query string "&q1=1", for example, consists of the parameter name "q1", the equal sign and the parameter value "1".
To summarize, the querystring consists of the following:
- a query string — &q1=1
- with a parameter name — q1
- and a parameter value — 1
This parameter value can be a number, indicating the nth answer option, or any text that will be filled out in an open text field.
Using the variable {{respondent.questions.myDataLabel}} (basic question piping), you can show the value of this first question in any subsequent question, provided they are on separate pages.
But what if your follow-up question is on the same page as this first hidden question? You don't want to split them up because you want your respondents to start filling out your survey as soon as possible, without losing time by clicking "Next" too many times.
That is where query string piping comes in.
Use the variable {{querystring.parameterName}} to show the parameter value of that particular query string. (e.g., {{querystring.q1}} will return the value of a the parameter in the querystring of the survey URL for question 1).
Example
You want to measure the level of satisfaction of your customer right after a specific support intervention. Your system registers the name of the person who resolved the ticket as well as a ticket ID. For your customer to quickly know which support ticket your survey is about, you wish to add it as an introductory sentence. Add the query strings "&q1=[ticketid]" and "&q2=[agentname]" to the survey URL. Then use the variables {{querystring.q1}} and {{querystring.q2}} in your survey to show this ticket and agent name, even on the very first page where these hidden questions 1 and 2 are located.
Your ticket {{querystring.q1}} was solved by {{querystring.q2}}.
In the survey, they will look like this:
The parameter can consist of anything you like. You could create your own variables from your database or third-party systems and add these to the URL (see Zendesk example for additional details). HTML and JavaScript are not allowed.