Piping: use answers from previous questions | LimeSurvey

Piping: use answers from previous questions

About piping

Piping puts an earlier answer into a later text, for example "What do you like most about your Laptop?" after a participant chose Laptop. You insert a placeholder with the question code in curly brackets, and LimeSurvey replaces it with the answer while the survey runs.

Insert an earlier answer

  1. Click the text where the answer should appear: a later question, its help description or the end screen.

  2. In the toolbar above the text, click the ⋮ button (1) and point to Placeholder fields (2).

  3. Under Fields based on previous answers (3), click the question. LimeSurvey inserts a placeholder such as {Q001.shown} at the cursor.

    The Placeholder fields menu with three areas numbered 1 to 3, the more button of the text toolbar, Placeholder fields and the previous answers

  4. Preview the survey with the eye icon in the top bar, answer the earlier question and check the text.

{Q001.shown} shows the answer the way the participant saw it, for example Laptop. {Q001} gives the answer code instead, for example A002. For text and number questions both give what the participant typed.

You can also type a placeholder yourself. The question must come before the text that uses it, and codes are case-sensitive. See Question and answer codes.

Note: In the editor, a placeholder stays as you typed it. It is replaced only in the running survey. If the earlier question is on the same page, the text updates as soon as the participant answers.

Insert participant and survey data

The same menu inserts data that is not an answer:

  • Participant email address, Participant first name and Participant last name come from the participant list. They stay empty for participants who open the survey through a public link.
  • Question ID, Question group ID, Survey ID and Survey expiration date come from the survey.

Vary the text

A placeholder can hold an expression. {if(Q001 == "A002", "laptop", "phone")} shows "laptop" to participants who chose the answer with the code A002 and "phone" to everyone else.

Next steps

FAQ

Why does my survey show {Q001} instead of the answer?

The code in the placeholder does not match a question before this text. Check the spelling and the upper and lower case of the code, and that the question comes earlier in the survey.

How do I greet invited participants by name?

Use Placeholder fields > Participant first name. It is filled for participants you invite from the participant list, and empty for everyone who uses a public link.