Question type

single

One coded answer from a list of options. The most common question type. Five styles cover the contexts a survey programmer typically needs.

What single is

single collects exactly one answer from a list of authored options. The respondent picks one; everything else is ignored. The stored answer is the option’s numeric code — not its label.

Mockup preview
QBrand single radio
Which brand do you prefer?
- qid: QBrand
    type: single
    text: Which brand do you prefer?
    options:
        1: Apple
        2: Samsung
        3: Sony
        4: LG

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typesingleRequired.
title, text, instructionrenderableVisible content. Use {{ }} to pipe runtime values. HTML allowed.
requiredTrue | FalseDefault True.
default.errorsTrue | False | custom stringDefault True (uses the platform’s required-field message).
validationcode blockPython; call fail() to reject. No default.
readonlyTrue | FalseDefault False. Set True to render the question but disable input — the respondent sees it but can’t change the value. Used with scripts that prefill or compute a value. Pair with visibility: hide to fully hide a helper question.
visibilityshow | hideDefault show. Override the default render state.
styleradio | dropdown | buttons | cards | image_cardsDefault radio.
orderfixed | random | randomEach | flip | alphabetical | reverseDefault fixed. How options are arranged. See below.
group.ordersame as orderDefault fixed. Order of named groups when group: is used.
layout.colsintegerDefault 1. Number of columns.
optionslist name or inline domainRequired when group: is not used.
options.fromexpressionFilter the visible options at runtime. No default.
groupgrouped list nameRequired when options: is not used.
customcode blockCustom runtime block. No default.

order values

ValueBehaviour
fixedRender options in authored order. Default.
randomStable random order — shuffled once per respondent, reused every time the question renders for them.
randomEachRe-shuffle every time the question is rendered. Relevant inside loops, where the same question renders once per iteration.
flipDeterministic split sample — half the respondents see authored order, half see reversed. The assignment is made once per respondent and reused across every flip surface in the survey, so a respondent’s order is consistent throughout.
alphabeticalSort options alphabetically by label.
reverseRender in reversed authored order for every respondent.

group.order and scale.order (on grids) accept the same values and behave the same way against the group / scale dimension.

Group properties

When using group: to subdivide options, each named group can carry:

PropertyValuesNotes
optionsgrouped option entriesRequired.
show.labelTrue | FalseDefault True. Set False to hide the group header label.
anchorTrue | FalseDefault False. Set True to pin the group in place under group.order: random.

Per-option properties

Expand an option to a map to attach extra behaviour.

PropertyValuesNotes
labelrenderableRequired when expanding the option. Display text. Use {{ }} to pipe runtime values.
imageURL stringRequired for every option under style: image_cards; optional under style: cards.
anchorTrue | FalseDefault False. Set True to pin in place under order: random.
specifyTrue | FalseDefault False. Set True to attach a free-text input to this option.
specify.sizeintegerWidth of the specify input field (chars). No default — platform sizes the input automatically.
specify.maxCharintegerMax length of the specify text. No default — unlimited unless set.
dataobjectMetadata object for advanced authoring (custom code can read it). No default.
options:
    1: Apple
    2: Samsung
    3:
        label: Other (please specify)
        specify: True
        specify.maxChar: 50
        anchor: True

Methods & accessors

The runtime values you read in scripts, conditions, validation, and piping. Return types are exact — see the Glossary for what Code, CodeSet, Label mean.

Accessors

ExpressionReturnsMeaning
Q.valueCodeThe chosen option code (number). None if unanswered.
Q.selectedCodeSetCollection containing the one chosen code.
Q.selectedLabelLabelDisplay label of the chosen option. None if unanswered.
Q.allCodeSetAll visible option codes (the effective domain).
Q.allLabelsLabelListLabels for Q.all.
Q.answeredboolTrue once the respondent has picked an option.
Q.notAnsweredboolInverse of answered.

Methods

ExpressionReturnsMeaning
Q.set(N)NoneSet the answer to code N (one numeric code). Used in scripts on hidden helpers.
Q.reset()NoneClear the answer.
Q.specify(N)SpecifyObjectRead the specify text for option N (when that option has specify: True).

Collection operations on Q.selected

The methods that read naturally on a single selection:

ExpressionReturnsMeaning
Q.selected.sizeintCount of selected codes. 0 or 1 for single.
Q.selected.any(N)boolTrue if code N is selected.
Q.selected.any([1, 2])boolTrue if any of the listed codes is selected.
Q.selected.intersect([1, 2, 3])CodeSetNew collection of overlap between the selection and the list. Non-empty result is truthy in if.

The same operations also work on Q.all and Q.allLabels. The full set (.every, .union, .minus) lives on every collection — see Collections for the full reference. On single, those broader methods are rarely used.

Codes are numbers. Q.value returns a Code — a number — not a string. Compare with QBrand.value == 2, not == “2”. Q.selected contains numbers too: {2}, not {"2"}.

Skins

Five visual styles. Pick by context — option count, label length, and whether the choice has a visual component.

radio Radio (default)
Apple
Samsung
Sony
Standard radio list. Best for 3–8 options.
cards Cards
Pro
Unlimited responses, basic logic.
Team
Multiple seats, advanced logic.
Larger tappable cards with optional description text.
buttons Buttons
Apple Samsung Sony LG
Pill buttons in a wrapping row. Best for 2–5 short options. Good on mobile.
image_cards Image cards
Design A
Design B
Image-first cards. Each option needs an image: URL.
dropdown Dropdown
Apple ▾
Collapsed select input. Best for long lists (10+ options).

For really long lists (50+ rows like states or hospitals), prefer lookup with type-ahead search over a plain dropdown — it lets the respondent type to filter.

The exact appearance is driven by theme tokens — colours, radii, fonts. Every survey is themable from the theme builder; the previews above use defaults. See Customisation and Skin variants.

See it work

A quick interactive preview. Pick an option and the Live state panel shows what the runtime stores.

Mockup preview
QBrand single radio
Which brand do you prefer?
Live state
QBrand.answeredFalse
QBrand.valueNone
QBrand.selected{}
QBrand.selectedLabelNone
QBrand.selected.size0
- qid: QBrand
    type: single
    text: Which brand do you prefer?
    options:
        1: Apple
        2: Samsung
        3: Sony
        4: LG
        5: None of these

Methods & accessors — live

The same preview shape, paired with a panel of expressions evaluating against the current selection. Pick an option above and watch each expression’s return value.

Mockup preview
QBrand single buttons
Which brand do you prefer?
Methods & accessors — live
QBrand.answered → —
QBrand.notAnswered → —
QBrand.value → —
QBrand.selected → —
QBrand.selectedLabel → —
QBrand.selected.size → —
QBrand.selected.any(2) → —
QBrand.selected.any([1, 2]) → —
QBrand.selected.intersect([1, 2, 3]) → —
QBrand.selected.intersect([1, 2, 3]).size → —
QBrand.value == 2 → —
QBrand.all.size → —

A few things to notice as you click:

  • value is a number. Pick “Samsung” and QBrand.value is 2, not "2". Compare with unquoted numbers: QBrand.value == 2.
  • selected is always a collection, even though single stores one code. The same routing patterns work across single, multi, rank, and grid rows because all of them expose .selected as a collection.
  • .size returns the count. For single that’s 0 or 1; for multi and rank it can be larger. The method is the same — the question type determines the range of values.
  • .any([1, 2]) and .intersect([1, 2, 3]) shine for screeners. Adding or removing qualifying codes is a list edit, not an operator change.

Examples

Screener — terminate the unqualified

- qid: QRole
    type: single
    text: Which best describes your role?
    options:
        1: Lab Director
        2: Lab Manager
        3: Nurse
        4:
            label: Other
            specify: True
            anchor: True

- script: |
    if not QRole.selected.any([1, 2]):
        endSurvey(status="terminate", redirect="https://example.com/thanks")

Anyone outside Lab Director / Lab Manager is terminated. The list form (any([1, 2])) lets you add qualifying codes later without touching the operator.

Conditional follow-up

- qid: QSatisf
    type: single
    text: How satisfied are you?
    style: buttons
    options:
        1: Very satisfied
        2: Satisfied
        3: Neutral
        4: Dissatisfied
        5: Very dissatisfied

- qid: QWhy
    type: open
    text: What would have made it better?
    if: QSatisf.selected.any([4, 5])
    style: textarea
    input.rows: 4

QWhy only shows for the dissatisfied. The if: is evaluated once, when the platform decides whether to render QWhy.

Pipe the chosen label into a follow-up

- qid: QBrand
    type: single
    text: Which brand do you prefer?
    options: brandList

- qid: QWhy
    type: open
    text: What do you like about {{ QBrand.selectedLabel }}?
    style: textarea
    input.rows: 3

If they pick “Samsung”, the next page asks “What do you like about Samsung?” — selectedLabel returns the label, not the code.

Hidden helper computed by a script

- qid: QState
    type: single
    text: In which state are you employed?
    style: dropdown
    options: states

- script: |
    # Group states into Census regions for downstream cuts.
    if QState.selected.any([1, 4, 9, 10, 17]):    hRegion.set(1)   # Northeast
    elif QState.selected.any([2, 3, 5, 6, 11]):   hRegion.set(2)   # South
    elif QState.selected.any([7, 8, 19, 20]):     hRegion.set(3)   # Midwest
    else:                                          hRegion.set(4)   # West

- qid: hRegion
    type: single
    options:
        1: Northeast
        2: South
        3: Midwest
        4: West
    visibility: hide
    readonly: True
    required: False

hRegion.set(N) writes a single numeric code (single accepts scalars only — no list or object form).

The h prefix is a naming convention for helper questions — it has no effect on its own. What actually hides hRegion from the respondent is visibility: hide; readonly: True then makes sure the value can only be written by the script. Without those flags the question would render normally.

Both QState and hRegion export normally — analysts get the raw state and the derived region.

”Other (please specify)” text capture — with validation

- qid: QBrand
    type: single
    text: Which brand do you prefer?
    options:
        1: Apple
        2: Samsung
        3: Sony
        4:
            label: Other (please specify)
            specify: True
            specify.maxChar: 50
            anchor: True
    validation: |
        if QBrand.selected.any(4):
            text = QBrand.specify(4).value or ""
            if len(text.strip()) < 3:
                fail("Please tell us which brand you mean (at least 3 characters).")

Picking code 4 reveals an attached free-text field. The text exports as QBrando4Specify — a separate column from the chosen code. To read the typed text in a script, use QBrand.specify(4).value.

The validation: | block runs after the respondent answers and before the next page renders. It receives the respondent’s answer through the same accessors used everywhere else (QBrand.selected, QBrand.specify(4).value). Calling fail() rejects the answer and shows the message — until the respondent fixes it, the page can’t be submitted. fail() takes a language code and the message text; multiple language codes are supported when the survey is multilingual.

Other validation idioms:

  • if not condition: fail(...) — invert the check.
  • Multiple checks — each fail() short-circuits the rest of the block, so the first failed check is the one shown.
  • No fail() called — the answer passes.

Mask options based on a previous answer

- qid: QBrand
    type: multi
    text: Which brands have you heard of?
    options: brandList

- qid: QFav
    type: single
    text: Which is your favourite of those?
    options: brandList
    options.from: QBrand.selected

QFav only shows brands the respondent picked at QBrand. The authored option list is preserved in the model; options.from filters which ones render.

Reusing an option list across questions

When the same option set appears on more than one question — states, countries, brands, hospitals, products — declare it once in a top-level - lists: block and reference it by name everywhere.

- lists:
    brandList:
        options:
            1: Apple
            2: Samsung
            3: Sony
            4: LG
            99: None of these

    stateList:
        options:
            1: Alabama
            2: Alaska
            # ... 47 more
            50: Wyoming

- qid: QAware
    type: multi
    text: Which brands have you heard of?
    options: brandList

- qid: QFav
    type: single
    text: Which is your favourite?
    options: brandList
    options.from: QAware.selected.minus([99])

- qid: QState
    type: single
    text: In which state do you live?
    style: dropdown
    options: stateList

The - lists: block lives at file level — it has no qid of its own and produces no question. It’s just a declarative bag of named option sets. Once declared, every question that needs a domain references it with options: <listName>. Edit the list once and every question that references it picks up the change.

For grouped lists and shared scales, see Defining lists.

Subdividing options into named groups

When the option list has natural sub-sections — clinical vs admin, EU vs non-EU, paid vs free tiers — group: lets you break it up with optional headers, per-group ordering, and per-group anchoring.

- qid: QRole
    type: single
    text: Which best describes your role?
    instruction: Select one.
    order: random            # randomise within each group
    group.order: random      # also randomise the groups themselves
    group:
        senior:
            show.label: False
            options:
                1: Lab Director
                2: Lab Manager
        clinical:
            show.label: False
            options:
                3: Nurse Supervisor
                4: Department Head
                5: Quality Director
        other:
            show.label: False
            anchor: True     # always last group
            options:
                99:
                    label: Other (please specify)
                    specify: True
                    anchor: True

group.order: random shuffles the groups; order: random shuffles the options within each group. Setting anchor: True on a group pins it (here, the “Other” group is always last regardless of group.order).

show.label: False hides the group heading — useful when the groups exist purely to control ordering and shouldn’t render as visible section breaks.

For a fully grouped reusable list (declare-once, use-everywhere), see Groups.

Image options for cards / image_cards

Visual choices — package designs, ad concepts, logo variants — work best with style: image_cards. Each option carries an image: URL.

- qid: QPackage
    type: single
    text: Which package design do you prefer?
    style: image_cards
    options:
        1:
            label: Design A
            image: /assets/pkg-a.png
        2:
            label: Design B
            image: /assets/pkg-b.png
        3:
            label: Design C
            image: /assets/pkg-c.png
        4:
            label: Design D
            image: /assets/pkg-d.png

image_cards renders the image prominently with the label underneath. The cards style accepts images optionally — useful when some options have illustrative images and others don’t, or when the description text is more important than the image.

Image URLs can be absolute (https://…) or relative (/assets/…); relative paths resolve against the survey’s media base.

Export

WhatColumn
The chosen codeqid (e.g. QBrand) — number
Specify textqidoNSpecify (e.g. QBrando4Specify) — string

single exports as one column. Masking with options.from affects which codes a respondent could pick, not the column shape. See Column naming.

See also