> For the complete documentation index, see [llms.txt](https://docs.askyazi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.askyazi.com/build-a-study/piping.md).

# Piping

Reuse a participant's earlier answers in later questions, in the question text, as the answer options, or as the rows of a matrix.

Piping reuses what a participant told you earlier in the same activity. You can quote an earlier answer in a question ("Why do you like **Brand B**?"), build a question's options from the options they chose ("Which of the brands you use is your favourite?"), or ask a matrix only about the items they picked. Each participant sees a question tailored to their own answers.

{% hint style="info" %}
**In short:** insert earlier answers into question text with a variable such as `{{Q8.answer}}`. Build answer options or matrix rows from earlier selections in the question's **Piping** window ("Offer the options they selected / didn't select in Q3"). Piping only works within one activity, and a piped question is skipped automatically for anyone with nothing to pipe.
{% endhint %}

## Three kinds of piping

| Kind                     | What it does                                                                                               | Example                                                                                                  |
| ------------------------ | ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| **Text piping**          | Inserts an earlier answer, or the participant's WhatsApp name, into the question text                      | "Hi {{whatsapp.name}}" or "Why do you shop at {{Q4.answer}}?"                                            |
| **Answer-option piping** | Builds a question's options from options the participant selected, or did not select, in earlier questions | Q5 "Which brands have you heard of?" then Q6 offers only those brands: "Which have you bought?"          |
| **Matrix piping**        | Uses earlier selections as matrix rows, or uses matrix ratings as the source for a later question          | Rate only the brands you use; then "Of the brands you rated Excellent or Good, which is your favourite?" |

## Pipe an answer into the question text

1. Open the question and place the cursor where the answer should go.
2. Type `{{` to open the variables menu and pick the earlier question, or the WhatsApp name variable.
3. Save. In the preview the variable shows as a placeholder; participants see their own answer.

<figure><img src="https://358667285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzMRQUXiGQlBwWdg6WEmG%2Fuploads%2FD2hreTCduZdy7UtccMcB%2Ffs-piping-window.webp?alt=media&amp;token=a8ecf513-41d4-4ca0-ac46-b8937ac82acd" alt="The Piping window: insert the WhatsApp name or an earlier answer into the question text, or repeat the question for each option picked"><figcaption></figcaption></figure>

Notes:

* `{{whatsapp.name}}` comes from the participant's WhatsApp profile name. Not everyone has one set, so Yazi uses a neutral fallback when it is missing, never the raw code. Write the sentence so it still reads well without a name.
* Text piping works in in-chat surveys and WhatsApp Flows.

## Pipe answer options

Use this when a later question should only offer options that make sense for that person.

{% stepper %}
{% step %}

### Create both questions

Create the source question (usually a Multi Select) and the follow-up question (Single Select, Multi Select or Matrix) after it in the same activity.
{% endstep %}

{% step %}

### Open the Piping window

On the follow-up question, open **Piping** from the question's menu. The window shows the question text and its variables at the top.
{% endstep %}

{% step %}

### Choose what to offer

Set the answers line, for example "Offer the options they **selected** in Q3" or "Offer the options they **didn't select** in Q3". You can add more than one earlier question as a source.

<figure><img src="https://358667285-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzMRQUXiGQlBwWdg6WEmG%2Fuploads%2FXtJiN49ZkKBPRPw5jqAn%2Ffs-piping-options.webp?alt=media&amp;token=769c1b79-3efa-49ee-b959-4ca65481c0a1" alt="Option piping: show only the options a participant picked, or did not pick, in an earlier question, with an example"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Check the example and apply

The window shows an example of what a participant would see. Nothing is saved until you click **Apply**.
{% endstep %}
{% endstepper %}

The piping icon lights up only on questions that actually use piping, so you can see at a glance where it is set.

### When there is nothing to pipe

If the source question was skipped, answered with **None of the above**, or left unanswered, the piped question is skipped and the participant moves on. They never see a question with no options.

## Pipe into and out of a matrix

**Into matrix rows.** A matrix can take its rows from an earlier Single Select or Multi Select, so each participant only rates the items they picked. Set it in the matrix question's Piping window.

**Out of a matrix.** A matrix can be the source for a later Single Select, Multi Select or Matrix. Use the **Only rows rated** control to choose which rating columns qualify. For example, offer only the attributes rated "Excellent" or "Very good" in a follow-up, or only the ones rated "Poor" in "Which of these is the worst?". Anyone with no qualifying rows skips the question.

Results and SPSS exports show one column for every possible row, so the dataset has the same shape for everyone.

Piping into matrix **columns** (the scale) is not available. Rows only.

## Repeating blocks

From a question's piping menu, **Configure repeating blocks** opens a window where you can repeat a set of questions for each item a participant chose earlier, using **Pull answer from** to name the source question.

If a participant leaves partway through a repeating block and comes back, the block restarts from its first item rather than guessing where they were.

## How piping behaves in practice

* **Frozen at publish.** Participants get the piping that was published. If you change piping, it reaches participants only after you publish again.
* **Renumbering is automatic.** Adding, moving or deleting questions updates the references.
* **Languages.** Piped answers appear in the participant's own language, and the results chart them under one option whatever language they were answered in.
* **Impossible questions are blocked.** If a piped question could never have anything to show (for example it pipes from a question that comes after it), the builder stops you publishing and explains why.
* **Duplicating** a study copies its piping.

## The ranking workaround

There is no ranking question type. To get a rank order, ask a Multi Select, then pipe the selected options into a Single Select for the participant's first choice, then into another Single Select for the second choice. See [Question types](https://docs.askyazi.com/build-a-study/question-types.md#ranking-questions).

## Limits and things to know

* **Same activity only.** A question can only use answers from its own activity. You cannot pipe from Day 1 into Day 2 of a multi-activity study.
* **Contact-list columns cannot be piped** into question text (for example a programme name from your uploaded list). Only answers given in the study, and the participant's WhatsApp name, can be piped. Use the invite template's variables for list data instead. See [Create a broadcast template](https://docs.askyazi.com/reach-participants/broadcast-templates.md).
* **Option and matrix piping in WhatsApp Flows** is not supported: the builder tells you if a setup will not work.
* **Live Forms** can pipe options from an earlier question. See [Live Forms](https://docs.askyazi.com/study-types/live-forms.md).
* **A list piped down to one option** cannot show as a tick-box form, so it falls back to a lettered list.
* **Option limits still apply.** A piped multi-select is still limited to 20 tappable options and a matrix to 10 rows. If a 16-option list feeds a matrix, cut the list to 10, because you cannot split a piped matrix in two.
* **Matrix scales cannot be piped**, only matrix rows.

## Related

* [Logic and routing](https://docs.askyazi.com/build-a-study/logic-and-routing.md)
* [Question types](https://docs.askyazi.com/build-a-study/question-types.md)
* [WhatsApp limits](https://docs.askyazi.com/build-a-study/whatsapp-limits.md)
* [In-chat vs WhatsApp Flows](https://docs.askyazi.com/build-a-study/in-chat-vs-whatsapp-flows.md)
