Text Piping

Compatibility:IdSurvey 7IdSurvey 8

IdSurvey allows you to display contact fields or previous answers within any text in the questionnaire.
In CATI and CAPI surveys you can also retrieve interviewers fields.
You can also display contact data in other survey texts such as start text, privacy or EmailSender and SMS sender campaigns.
 

Open the recap table to see the complete list of text piping functions or see the examples you are interested in.
 

To retrieve contact data, simply write the name of the field in curly brackets, for example {name}.
During the interview IdSurvey will display the value of the corresponding field.
In this example Text Piping is used to compose the text of a custom email.
 

Text set:
Hello {first name} {surname},
we invite you to answer this short questionnaire to know your opinion about the car {model_car} that you recently rented.

 

Text displayed:
Hello John Smith,
we invite you to answer this short questionnaire to know your opinion about the Audi A6 car you recently rented.

To retrieve an interviewer data, just write the name of the field between hash symbols, for example #name#.
In this example Text Piping is used to compose the introductory text of a CATI survey.
 

Text set:
Good morning Mr. {surname},
I’m the agent #name# and I’m contacting you on behalf of ACME.
We are conducting a survey on…

 

Text displayed:
Good morning Mr. Smith,
I’m the agent Marco and I’m contacting you on behalf of ACME.
We are conducting a survey on…

To recall a previous answer of the questionnaire it is necessary to write the question code in square brackets, for example [Q5].
IdSurvey will show the open answer to the indicated question or, if not available, the label of the selected answer.

Notes:

  • The Text Piping to retrieve a previous answer can only be used on the texts of the questionnaire (question texts, answers, headers, etc.).
  • You cannot use Text Piping to retrieve answers to questions on the same page. However, in this case you can use the getResponse function on Dynamic Text.
  • To retrieve open-ended answers within conditions, FlowScript and Dynamic Text, the question code in square brackets is used, similar to the syntax of Text Piping. 
However, the two behaviors are different: in Text Piping the question code in square brackets shows the open-ended answer or – if not available – the labels of the selected options. While on logic conditions, FlowScript and Dynamic Text the same syntax retrieves only the text inserted in the open-ended answer. 
To simulate the behavior of Text Piping within FlowScript, Dynamic Text and Conditions, you can use the getResponse function.
 

Example on a single select

The label of the selected answer or, if present, the text of the open answer is shown.
 

Text set:
You said you subscribed to [Q5]. How satisfied are you with the service offered?
 

Text displayed:
You said you subscribed to Netflix. How satisfied are you with the service offered?
 

Example on a multiple choice

All the labels of the selected answers and any text inserted in the open-ended answer are shown.
 

Text set:
You said you subscribed to [Q21]. Which of these services do you prefer?
 

Text displayed:
You said you subscribed to Netflix|Amazon Prime|Hulu. Which of these services do you prefer?

Contact field{field_name}{name}

It displays the value of the field “name”.

Interviewer field#name##name#

It displays the value of the interviewer field “name”

Single select question[QuestionCode][Q1]

It displays the option selected.

Multiple option question[QuestionCode][Q1]

It displays all the options selected.

Matrix row[MatrixCode.RowCod][Q1.1]

It displays the answer given to row .1 of grid Q1.

3d matrix cell[MatrixCode.RowCode.ColumnCode][Q1.1.1]

It displays the answer given to the intersection cell of row .1 with column .1 in matrix Q1.

Multiple choice question(only one specific option, if selected)[QuestionCode:AnswerCode][Q1:99]

If selected, it displays the answer with code 99 of question Q1.

Multiple choice question

(more options, if selected)

[QuestionCode:AnswerCode,AnswerCode…][Q1:1,2,3]

If selected, it displays the answers with code 1, 2 and 3 of question Q1.

Data inserted in the comment box*|QuestionCode|**|Q1|*

It displays the text entered in the comment box.

Text Piping has a simplified syntax and is the most convenient and suitable solution for most cases. But for some particular purposes it may be necessary to use Dynamic Text.
Dynamic Text provides advanced functions to compose conditioned texts, complex rules and algebraic expressions, with virtually unlimited possibilities.
In this article you will find only a brief hint about the possibilities of Dynamic Text. You can find more information in this knowledge base and the complete list of functions in the FlowScript article.

Notes:

  • To retrieve open-ended answers within conditions, FlowScript and Dynamic Text, the question code in square brackets is used, similar to the syntax of Text Piping. 
However, the two behaviors are different: in Text Piping the question code in square brackets shows both the open-ended answer and the labels of the selected options. While on conditions, FlowScript and Dynamic Text the same syntax only retrieve the text inserted in the open-ended answer. 
To simulate the behavior of Text Piping within FlowScript, Dynamic Text and Conditions, you can use the getResponse function.
  • Unlike Text Piping, Dynamic Text also allows you to retrieve answers given to questions on the same page.

STEP 1

To add a dynamic text click on the button DYN-TEXT that you find in any text editor of the questionnaire.

STEP 2

Add the desired expression, function or condition.

STEP 3

Click OK to confirm. The Dynamic Text will be highlighted in blue.
dynamic text

Algebraic expressions

You can write algebraic expressions of any complexity by retrieving previous open-ended answers or contact data. To retrieve open-ended answer, simply write the code of the corresponding question in square brackets.
 

Text set:
According to the data that you indicated for the 4 quarters of last year, it seems that your company has billed a total of € [Q2.1]+[Q2.2]+[Q2.3]+[Q2.4]. Do you expect to reach this turnover for the current year?
 

Text displayed:
According to the data that you indicated for the 4 quarters of last year, it seems that your company has billed a total of € 345000. Do you expect to reach this turnover for the current year?
 
 

Text set:
The average of your grades is ( [Q1]+[Q2]+[Q3] ) / 3
 

Text displayed:
The average of your grades is 7.5…

 

Retrieve an item based on its ranking position.

You can display the label of an item according to the ranking position of a Drag&amp question;Drop (or matrix question with exclusive columns).
This feature is not part of Text Piping but you can still use it to compose the text of a question or answer using the getItemByRanking function within Dynamic Text.
Write getItemByRanking by entering the Drag&amp question code;Drop and specifying the ranking position you want to retrieve.
 

Text set:
The smartphone you ranked as first is getItemByRanking(Q1, 1). Please explain the main reasons that influenced your choice.
 

Text displayed:
The smartphone you ranked as first is Apple iPhone 12. Please explain the main reasons that influenced your choice.
 

Retrieve the labels of the selected answers within the Dynamic Text

The getResponse function allows you to simulate the behavior of Text Piping within Dynamic Text, Conditions and FlowScript.
It allows you to specify the type of data to retrieve between open-end answers, label, code and comment area. If the type is not specified (or set to auto) the getResponse function simulates the behavior of Text Piping by proposing both the open response and the label of the selected options.
In addition, you can specify the separator character of multiple answers.
 

Text set:
In the option getResponse(Q1, label) you indicated the model getResponse(Q1, open). Will you purchase this model in the following months?
 

Testo visualizzato:
In the option Other you indicated the model Samsung Galaxy S10. Will you purchase this model in the following months?
 
 

Text set:
You said you subscribed to getResponse(Q1, auto, ', '). Which of these services do you prefer?
 

Text displayed:
You said you subscribed to Netflix, Prime Video, Apple TV+. Which of these services do you prefer
 

Edit the text based on a condition

By using Dynamic Text you can edit any text in the questionnaire according to one or more conditions. This function is particularly useful to manage singulars and plurals, male and female, or to add notes to telephone interviewers that should not be displayed in CAWI interviews of the same survey.
Find more details on the article Dynamic Text.
 

Text set:
Which brand is (Q1==1) ? 'your car' : 'l\'the car you use the most'?
 

Text displayed if I selected option 1 at question Q1:
Which brand is your car?
 

Text displayed if I didn’t select the option 1 at question Q1:
Which brand is the car you use the most?