Back to Help
Surveys

Pipe Text From Variables and Previous Answers

Use earlier answers or variables inside later prompts when a respondent-specific label is helpful.

What Text Piping Does

Text piping lets a later part of a survey reuse information the respondent already gave, or a variable created by the survey. Use it to make prompts feel specific without asking the same question twice.

How To Pipe Text (Syntax)

Type a token in double curly braces. The engine matches and replaces each token with the live answer or variable value. Spaces next to the braces are optional, so and behave the same.

Pipe a previous answer

Use the answer prefix and the question's Question Name (set on the question card in Block Builder):

Equivalent prefixes Domandata also accepts: ans:, q:, or question: instead of answer:.

Pipe a survey variable

Use the var prefix and the variable name (for example from custom question JavaScript or other logic that writes into the survey's variable map):

For nested objects, use dot paths inside the token:

Equivalent prefixes: vars: or js: instead of var:.

Full sentence example

If an earlier Short Answer question is named respondent_name, a later prompt can say:

During the survey, Domandata replaces the token with the respondent's answer.

Pipe From A Previous Answer

Use this format to insert an answer from an earlier question:

The most reliable reference is the question's Question Name. You can set it from the small name field on the question card in Block Builder. Good names are short and stable, such as respondent_name, favorite_brand, or party_id.

Examples

  • inserts the answer to the question named respondent_name.
  • inserts the selected or typed favorite brand.
  • can work for the displayed question label, but a custom question name is safer.

Block Builder: Question Name

Block Builder: Question Name

The export variable label is the column name for this question in downloaded data.

Closing text
Redirect (optional)

Pipe From A Variable

Use this format to insert a survey variable:

Variables can come from advanced question JavaScript or other survey logic that creates variables. For nested variable objects, use dot notation:

Example

If a question's JavaScript declares a variable named treatment_label, later text can use:

Block Builder: Question Type

Block Builder: Question Type

Use the question type selector to switch between multiple choice, slider, grid, ranking, and more.

Closing text
Redirect (optional)

Capitalize Piped Text

Add a capitalization command before any token to control how the piped value is cased. The command comes first, followed by a dot, then the normal token:

Available commands

CommandResultExample output
upper.All uppercaseJOHN SMITH
lower.All lowercasejohn smith
titlecase.First letter of each word capitalizedJohn Smith
upperfirst.First character uppercase onlyJohn smith
lowerfirst.First character lowercase onlyjOHN SMITH

Examples

  • — pipes the answer to respondent_name in all caps.
  • — pipes the variable treatment_label in Title Case.
  • — pipes the answer to city with only the first letter uppercased.
  • — pipes a nested variable value in all lowercase.

The command is case-insensitive, so and behave the same.

Where You Can Use Piped Text

Piped text is rendered in the participant-facing survey. Current supported places include:

  • Question prompt text.
  • Custom HTML in a question.
  • Multiple Choice answer labels.
  • Dropdown options and placeholder text.
  • Ranking item labels.
  • Grid Matrix row, column, and slider endpoint labels.
  • Conjoint row, column, and cell labels.
  • Slider endpoint labels.

Preview: Respondent Experience

Block Builder
Preview
Deploy

Preview

Walk through respondent-facing behavior in the same preview surface.

Recommended Pattern

  1. Step 1: Create the source question. In Block Builder, add the question that collects the value you want to reuse.

    Step 1: Create the source question

    Survey Editor

    No-persist demo using the real builder shell.

    Add a Block

    Trash is empty.

  2. Step 2: Name the source question. Use the question name field and choose a stable name such as first_name, favorite_brand, or party_id.

    Step 2: Name the source question

    Block Builder: Question Name

    The export variable label is the column name for this question in downloaded data.

    Closing text
    Redirect (optional)
  3. Step 3: Add the later prompt. In a later block or question label, type the token, such as .

    Step 3: Add the later prompt

    Block Builder: Pipe Text

    The token {{answer:party_id}} is replaced at runtime with the respondent's earlier answer. Set the question name on the source question so the token resolves correctly.

    Closing text
    Redirect (optional)
  4. Step 4: Check the order. Make sure the source question appears earlier on every respondent path that uses the piped text.

    Step 4: Check the order

    Block Builder
    Preview
    Deploy

    Flow Canvas

    Interactive routing surface from the app, running in no-persist help mode.

    Consent and Study Intro

    1 question

    Political Knowledge Block

    2 questions

    Control Message

    1 question

    Treatment Message

    1 question

    Outcome Measures

    2 questions

    Survey Ends

    Anchors explicit end of survey

  5. Step 5: Preview the path. Open Preview, answer the source question, and confirm the later text resolves correctly.

    Step 5: Preview the path

    Block Builder
    Preview
    Deploy

    Preview: Pipe Text

    The {{answer:party_id}} token resolves to whatever the respondent typed. Answer the source question to see the follow-up text update in real time.

  6. Step 6: Inspect export if needed. Submit a test response and review Export when the piped value matters for analysis or auditing.

    Step 6: Inspect export if needed

    Block Builder
    Preview
    Deploy

    Export

    Download analysis-ready response data from the Export tab.

What Happens If A Value Is Missing

If Domandata cannot find a referenced answer or variable, it leaves the token in place. Seeing text like in preview usually means the referenced question has not been answered yet, the name is misspelled, or the question appears later in the survey.

Block Builder: Question Name

Block Builder: Question Name

The export variable label is the column name for this question in downloaded data.

Closing text
Redirect (optional)

Tips For Research Surveys

  • Use question names instead of full prompt text so edits do not break references.
  • Keep names lowercase and readable, such as city, condition_label, or baseline_trust.
  • Only pipe from questions that appear earlier on the respondent's path.
  • For randomized or branched surveys, preview each relevant path.
  • Avoid piping sensitive identifiers into places where participants do not need to see them.

Related Help