multi
Multiple coded answers from a list of options. Checkboxes, button bars, cards, image cards. Supports answer-count constraints and exclusive options.
What multi is
multi collects zero or more selections from a list of authored
options. Answers are stored as a collection of codes, in authored
domain order (not the order the respondent clicked).
Selection-count constraints — min, max, exact — bound how many
items the respondent must pick. An option marked exclusive: True
clears every other selection when chosen — typical “None of these”
behaviour.
- qid: QFeatures
type: multi
text: Which features matter to you?
instruction: Select all that apply.
options:
1: Battery life
2: Camera quality
3: Screen size
4: Build quality
5: Price
Properties
| Property | Values | Notes |
|---|---|---|
qid | string | Required. Unique within the survey. |
type | multi | Required. |
title, text, instruction | renderable | Visible content. Use {{ }} to pipe runtime values. HTML allowed. |
required | True | False | Default True. |
default.errors | True | False | custom string | Default True (uses the platform’s required-field message). |
validation | code block | Python; call fail() to reject. No default. |
readonly | True | False | Default 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. |
visibility | show | hide | Default show. |
style | checkbox | buttons | cards | image_cards | dropdown | Default checkbox. |
order | keyword or expression | Keywords: fixed (default), random, randomEach, alphabetical, reverse, flip — see below. Also accepts an expression like Q1.all, Q1.selected, or a literal [2, 4, 1, 3] that resolves to an ordered code list. See Order. |
group.order | same as order | Default fixed. Order of named groups. |
layout.cols | integer | Default 1. Number of columns. |
min | integer | Minimum selections required. No default (no lower bound). |
max | integer | Maximum selections allowed. No default (no upper bound). |
exact | integer | Exactly this many selections. Overrides min and max when both are set. No default. |
options | list name or inline domain | Required when group: is not used. |
options.from | expression | Filter the visible options at runtime. No default. |
group | grouped list name | Required when options: is not used. |
custom | code block | Custom runtime block. No default. |
order values
| Value | Behaviour |
|---|---|
fixed | Render options in authored order. Default. |
random | Stable random order — shuffled once per respondent, reused every time the question renders for them. |
randomEach | Re-shuffle every time the question is rendered. Relevant inside loops. |
flip | Deterministic split sample — half the respondents see authored order, half see reversed. Consistent for the respondent across every flip surface. |
alphabetical | Sort options alphabetically by label. |
reverse | Render in reversed authored order for every respondent. |
group.order accepts the same values and behaves the same way against
the group dimension.
Group properties
When using group: to subdivide options, each named group can carry:
| Property | Values | Notes |
|---|---|---|
options | grouped option entries | Required. |
show.label | True | False | Default True. Set False to hide the group header label. |
anchor | True | False | Default 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.
| Property | Values | Notes |
|---|---|---|
label | renderable | Required when expanding the option. Use {{ }} to pipe runtime values. |
image | URL string | Required for every option under style: image_cards; optional under style: cards. |
anchor | True | False | Default False. Set True to pin in place under order: random. |
exclusive | True | False | Default False. Set True so picking this option clears every other selection in the question. Typical use: “None of these”. |
specify | True | False | Default False. Set True to attach a free-text input to this option. |
specify.size | integer | Width of the specify input. No default. |
specify.maxChar | integer | Max length of the specify text. No default — unlimited unless set. |
data | object | Metadata object for advanced authoring (custom code can read it). No default. |
options:
1: Battery life
2: Camera quality
3: Screen size
4:
label: Other (please specify)
specify: True
anchor: True
99:
label: None of these
exclusive: True
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
| Expression | Returns | Meaning |
|---|---|---|
Q.selected | CodeSet | Collection of selected codes, in authored domain order. |
Q.selectedLabels | LabelList | Collection of selected labels, in the same order as Q.selected. |
Q.all | CodeSet | All visible option codes (the effective domain). |
Q.allLabels | LabelList | Labels for Q.all. |
Q.answered | bool | True once the respondent has made at least one selection. |
Q.notAnswered | bool | Inverse of answered. |
Q.selectedLabel does not exist on multi (because there can be more than one selected label). Use Q.selectedLabels.at(0) if you need just the first.Methods
| Expression | Returns | Meaning |
|---|---|---|
Q.set(N) | None | Set the selection to a single code. |
Q.set([1, 3]) | None | Set the selection to a list of codes. |
Q.add(N) | None | Add code N to the selection without clearing existing selections. |
Q.reset() | None | Clear all selections. |
Q.specify(N) | SpecifyObject | Read the specify text for option N (when that option has specify: True). |
Q.row(N) | EntryObject | Returns an entry proxy for option N. Exposes .label only — useful for reading the label whether or not the option is selected. |
Q.set() also accepts a more explicit per-code form for hidden helpers
that need precise control. See Advanced below.
Collection operations on Q.selected
The methods that read naturally on a multi-select answer:
| Expression | Returns | Meaning |
|---|---|---|
Q.selected.size | int | Count of selected codes. |
Q.selected.at(N) | Code | Code at zero-based position N, in authored order. |
Q.selected.any(N) | bool | True if code N is selected. |
Q.selected.any([1, 2]) | bool | True if any of the listed codes is selected. |
Q.selected.every([1, 2]) | bool | True if every code in the list is selected. |
Q.selected.intersect([1, 2, 3]) | CodeSet | New collection of overlap. Non-empty result is truthy in if. |
Q.selected.union([2, 3]) | CodeSet | Combined collection, deduplicated. |
Q.selected.minus([99]) | CodeSet | Selection minus the listed codes — useful for excluding “None of these” before piping. |
The same operations also work on Q.selectedLabels, Q.all, and
Q.allLabels. See Collections for the full
reference.
Skins
Five visual styles. Pick by context — option count, label length, and whether the choice has a visual component.
checkbox Checkbox (default) cards Cards buttons Buttons image_cards Image cards dropdown Dropdown 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. Tick options and the Live state panel shows what the runtime stores.
QFeatures.answeredFalseQFeatures.selected{}QFeatures.selectedLabels{}QFeatures.selected.size0QFeatures.selected.at(0)None- qid: QFeatures
type: multi
text: Which features matter to you?
instruction: Select all that apply.
options:
1: Battery life
2: Camera quality
3: Screen size
4: Build quality
5: Price
99:
label: None of these
exclusive: True
anchor: True
Try ticking a couple of features, then “None of these” — note that the exclusive option clears the others. Pick another feature again and “None” clears.
Methods & accessors — live
The same preview shape, paired with a panel of expressions evaluating against the current selection. Tick options above and watch each expression’s return value.
QFeatures.answered → — QFeatures.selected → — QFeatures.selectedLabels → — QFeatures.selected.size → — QFeatures.selected.at(0) → — QFeatures.selectedLabels.at(0) → — QFeatures.selected.any(2) → — QFeatures.selected.any([1, 2]) → — QFeatures.selected.every([1, 2]) → — QFeatures.selected.intersect([1, 2, 3]) → — QFeatures.selected.intersect([1, 2, 3]).size → — QFeatures.selected.union([2, 3]) → — QFeatures.selected.minus([5]) → — A few things to notice as you click:
selectedis in authored domain order, not the order you ticked. Tick code 3 first then code 1 — the result is{1, 3}, not{3, 1}. Same goes forselectedLabels.selectedLabels.at(0)is how you get “the first label” — there’s noselectedLabel(singular) on multi..every([1, 2])is the canonical “did they pick both of these?” check — different from.any([1, 2])which is “did they pick either?”..intersect([list]).sizeis the workhorse for “how many of this set did they pick?” — useful when the threshold matters (e.g. “must pick at least 2 of 5 hot-button issues”).
Examples
Selection-count constraints
- qid: QTop3
type: multi
text: Pick your top three.
instruction: Choose exactly three.
exact: 3
options:
1: Battery life
2: Camera
3: Screen
4: Build
5: Price
| Setting | Effect |
|---|---|
min: N | Must pick at least N. |
max: N | Cannot pick more than N. |
exact: N | Must pick exactly N. Overrides min and max. |
The runtime enforces these before the respondent can advance. The
default error message is the platform’s required-field message;
override with default.errors: "your message here" if you want
something more specific.
”None of these” — exclusive option
- qid: QBrand
type: multi
text: Which of these brands have you heard of?
options:
1: Apple
2: Samsung
3: Sony
4: LG
99:
label: None of these
exclusive: True
anchor: True
- script: |
if QBrand.selected.any(99):
endSurvey("terminate")
exclusive: True clears all other selections when “None” is picked
(and vice versa — picking another option clears “None”). anchor: True keeps it pinned at the bottom under order: random.
Conditional follow-up
- qid: QSatisf
type: multi
text: Which areas need improvement?
options:
1: Service
2: Price
3: Reliability
4: Selection
- qid: QWhy
type: open
text: Tell us more about what needs improving.
if: QSatisf.selected.size > 0
style: textarea
input.rows: 4
QWhy only shows when at least one area was flagged. .size > 0 is
the simplest “did they pick anything?” check.
Pipe the chosen labels into a follow-up
- qid: QBrand
type: multi
text: Which brands have you used?
options: brandList
- qid: QFav
type: open
text: Of {{ QBrand.selectedLabels }} which is your favourite, and why?
style: textarea
The collection of labels stringifies as "Apple", "Samsung" when
piped — readable in a question stem. For just the first label use
{{ QBrand.selectedLabels.at(0) }}.
Mask the next question
- qid: QBrand
type: multi
text: Which brands have you heard of?
options: brandList
- qid: QFav
type: single
text: Which is your favourite?
options: brandList
options.from: QBrand.selected.minus([99])
QFav only shows brands the respondent picked — minus the “None of
these” code so 99 doesn’t leak into the favourite question.
Combining two multis
- qid: QAwarePast
type: multi
text: Which brands have you ever used?
options: brandList
- qid: QAwareNow
type: multi
text: Which brands do you use today?
options: brandList
- script: |
everUsed = QAwarePast.selected.union(QAwareNow.selected)
print("Total brand exposure:", everUsed.size)
onlyPast = QAwarePast.selected.minus(QAwareNow.selected)
if onlyPast.size > 0:
# Brands they tried but no longer use — interesting churn signal.
hChurnedBrands.set(list(onlyPast))
.union() combines collections (deduplicated). .minus() subtracts.
.intersect() finds overlap. These three are the routine set-algebra
tools you’ll reach for whenever two multi answers need to be
combined.
Validation example
- qid: QChannels
type: multi
text: Which channels do you use to research products?
min: 1
options:
1: Search engines
2: Social media
3: Friends and family
4: Industry publications
5:
label: Other (please specify)
specify: True
validation: |
if QChannels.selected.any(5):
text = QChannels.specify(5).value or ""
if len(text.strip()) < 3:
fail("Please tell us which channel you mean.")
# Encourage at least two channels for richer data — but don't block.
if QChannels.selected.size == 1:
print("Single-channel respondent — flag for review.")
validation: | runs after the respondent answers. fail() rejects
with a message; print() writes to the editor’s diagnostic panel
without blocking. Multiple fail() calls short-circuit on the first
that fires.
Reusing an option list
For long or shared option sets, declare a - lists: block once and
reference by name everywhere — same pattern as
single.
- lists:
brandList:
options:
1: Apple
2: Samsung
3: Sony
4: LG
99: None of these
- qid: QAware
type: multi
text: Which brands have you heard of?
options: brandList
- qid: QUsed
type: multi
text: Which have you used?
options: brandList
options.from: QAware.selected.minus([99])
Advanced
Patterns that programmers reach for less often, but are worth knowing when they apply.
Tri-state set() — explicit per-code control
In addition to the scalar (Q.set(2)) and list (Q.set([1, 3]))
forms, multi.set() accepts a tri-state object that lets you
spell out, per code, whether it should be selected, shown but not
selected, or not shown at all:
QFeatures.set({
1: 1, # selected
2: 0, # shown to the respondent, not selected
3: None, # not shown — masked out, exports as null
})
Why use it? Because the export tri-state
distinguishes 0 from null. With the simpler forms, every
unselected code defaults to 0. The tri-state form is the only way
to write null programmatically — handy when a hidden helper needs
its export shape to match what the respondent would have produced
under masking.
A worked example — a hidden helper whose value mirrors a respondent’s choice but explicitly clears the codes that weren’t relevant:
- qid: QFeatures
type: multi
text: Which features matter?
options:
1: Battery
2: Camera
3: Screen
4: Build
5: Price
- qid: hPriceSensitive
type: multi
options:
1: Yes
2: No
visibility: hide
readonly: True
required: False
- script: |
if QFeatures.selected.any(5):
hPriceSensitive.set({1: 1, 2: 0})
else:
hPriceSensitive.set({1: 0, 2: 1})
If you only need “select these codes”, the list form
(Q.set([1, 3])) is simpler and what you should reach for first.
The tri-state form is for cases where the export’s 1 / 0 /
null distinction matters.
Export
multi fans out to one column per option:
| What | Column |
|---|---|
| Code N selected? | qidoN (e.g. QFeatureso1, QFeatureso2) |
| Specify text | qidoNSpecify (e.g. QFeatureso4Specify) |
Each column is tri-state:
| Value | Meaning |
|---|---|
1 | The option was shown to the respondent and selected. |
0 | The option was shown to the respondent and not selected. |
null | The option was not shown — masked by options.from or skipped via if. |
The distinction matters whenever options are masked: a null means
“they never saw this choice”, which is very different from “they
saw it and rejected it”. See
Tri-state projection for the full
treatment.
See also
- single — when only one selection is allowed.
- rank — when ordering matters.
- gridMulti — multi-select in a row × scale grid.
- Conditional & dynamic —
options.from,if. - Collections — every method on
.selected. - Tri-state projection — what
nullmeans in the export.