Question and answer codes

Question and answer codes

What codes are

Every question, sub-question, and answer option in LimeSurvey has a short identifier — its code:

  • Question codes — one per question, such as Q001. LimeSurvey assigns these automatically; you can rename them.
  • Sub-question codes — one per row of a question with sub-questions (arrays, multiple short text…), such as SQ001, SQ002.
  • Answer option codes — one per answer option, such as A001.

You can ignore codes entirely for a simple survey. They matter the moment you use anything that refers to an answer: piping ({name}), conditions, validation equations, equation questions — and they become the column names when you export responses for analysis.

Showing the codes in the editor

By default the editor hides codes. There are two ways to turn them on:

  • Right-click a question in the Structure sidebar and choose Show/hide question codes. The same menu offers Copy question code — handy when writing an expression.
  • Or open the "..." menu in the top bar and under View, choose Question codes.

With codes shown, each question in the Structure sidebar gets a code badge next to its name (Q001, Q002…), and on the canvas each sub-question shows its code (SQ001, SQ002…) in a small box next to the row.

Changing a code

  • Question code — click the question, open the Question settings panel, and edit the Question code field (on the Advanced tab). This is also where you give questions meaningful names: renaming Q001 to age makes every expression that uses it readable — {age} instead of {Q001}.
  • Sub-question code — with codes shown, click the code box next to the sub-question on the canvas and type.

Codes must be unique within the survey and are kept short — letters and numbers. If you plan to reference a question in logic or text, rename its code before writing the expressions; expressions refer to codes by name, so renaming afterwards means updating every expression that uses the old one.

Where you meet codes again

  • Piping: Hello {firstname} shows the answer to the question coded firstname.
  • Conditions and validation: a sub-question is addressed as question code + underscore + sub-question code, e.g. Q001_SQ001; an answer option by its code, e.g. A001.
  • Exports: your response file's columns are named by these codes — one more reason to make them meaningful before fieldwork starts.

Related articles

    • Related Articles

    • Insert Answer from Previous Question

      Insert answers from previous questions LimeSurvey allows you to insert answers from previous questions into the text of a question. You can refer to answers on the same page and even dynamically update tailored messages as responses change on the ...
    • Conditions: show a question only when it applies

      A condition makes a question appear only when it is relevant. Ask "Which brand do you drive?" only of people who said they own a car, or show a follow-up only to people who rated you poorly. Two things are worth understanding before you start: ...
    • Question Settings

      Question settings Note: The question settings panel is displayed when you add/edit a question and is located on the right. The settings displayed may vary based on the question type selected. Please refer to the screenshot below for a basic overview ...
    • Question Summary

      Question summary The page is divided into three sections. Question toolbar: You will find the following options on the toolbar: Preview survey: Click to preview the entire survey. Preview question group: Click to preview only the current question ...
    • Import a Question

      Importing a question The following steps demonstrate how to import a question to a survey: Note: Importing a single question is a classic-editor feature — the new editor has no question import (whole-survey import happens from the survey list; the ...