Question type

gridMulti

A grid where every row can hold multiple selections from a shared scale. Use × scale matrices, channel × purpose tables, feature × audience grids.

What gridMulti is

gridMulti shows a table with one row per item and one column per scale point. Each row stores a collection of selected scale codes — zero, one, or many. Common shape: items down the rows, an “applies to all that apply” scale across the columns. Selection counts are bounded per row by min / max / exact.

Mockup preview
QChannels gridmulti
Where do you use each channel?
Tick all that apply.
- qid: QChannels
    type: gridMulti
    text: Where do you use each channel?
    instruction: Tick all that apply.
    options:
        1: Email
        2: Phone
        3: SMS
    scale:
        1: At home
        2: At work
        3: On the go

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typegridMultiRequired.
title, text, instructionrenderableVisible content. Use {{ }} to pipe runtime values. HTML allowed.
requiredTrue | FalseDefault True.
default.errorsTrue | False | custom stringDefault True.
validationcode blockPython; call fail() to reject. No default.
readonlyTrue | FalseDefault False. Set True to render the question but disable input — the respondent sees the rows but can’t change the values. Pair with visibility: hide to fully hide a helper question.
visibilityshow | hideDefault show.
stylecheckboxGrid | cardStack | chipGridDefault checkboxGrid. See Styles below.
orderfixed | random | randomEach | flip | alphabetical | reverseDefault fixed. Row order.
group.ordersame as orderDefault fixed. Order of named row groups.
scale.ordersame as orderDefault fixed. Order of scale columns.
scale.repeattop | bottom | both | stickyDefault top. Where the scale-label header is repeated in long grids.
scale.repeat.everyinteger (≥ 1)Cadence — repeat the scale labels every N rows.
layout.colsintegerDefault 1.
layout.widthstringCustom width override.
label.positiondefault | left | rightWhere the row label sits relative to the inputs.
minintegerMinimum selections per row. No default.
maxintegerMaximum selections per row. No default.
exactintegerExactly this many selections per row. Overrides min/max. No default.
optionslist name or inline domainRequired when group: is not used. The rows.
options.fromexpressionFilter the visible rows at runtime. No default.
groupgrouped list nameRequired when options: is not used.
scalelist name or inline domainRequired. The columns (scale points).
scale.fromexpressionFilter the visible scale columns at runtime. No default.
customcode blockCustom runtime block. No default.
dataobjectMetadata object for advanced authoring. No default.
min / max / exact are per-row. Each row independently must meet the selection-count constraint. min: 1 means every row must have at least one tick; it does not mean “at least one row must be answered overall”.

Group properties

When using group: to subdivide rows:

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

Per-row properties

Expand a row to a map to attach extra behaviour.

PropertyValuesNotes
labelrenderableRequired when expanding the row.
anchorTrue | FalseDefault False. Pin in place under order: random.
exclusiveTrue | FalseDefault False. Set True to make the row mutually exclusive within itself — only one scale code can be ticked in this row at a time. Picking a new cell collapses the row’s selection to just that code. Other rows are unaffected. Useful when a particular row should behave like single-select while the rest of the grid stays multi-select.

Per-scale properties

Expand a scale entry to a map to attach extra behaviour.

PropertyValuesNotes
labelrenderableRequired when expanding the scale entry.
anchorTrue | FalseDefault False. Pin in place under scale.order: random.
exclusiveTrue | FalseDefault False. When ticked in a given row, every other scale code in that row is cleared. Typical “Not applicable” / “None of these” pattern, scoped per row.

Methods & accessors

Accessors

Question accessors

ExpressionReturnsMeaning
Q.allCodeSetAll visible row codes (the row domain).
Q.allLabelsLabelListLabels for Q.all.
Q.answeredboolTrue if any row has at least one selection.
Q.notAnsweredboolInverse.
No question-level selected on gridMulti. Selections are per-row only. To check “did any row pick code N?”, walk Q.all: any(Q.row(c).selected.any(N) for c in Q.all).

Row accessors

Q.row(N) returns a row proxy. N is the row code (not a position).

ExpressionReturnsMeaning
Q.row(N).selectedCodeSetCollection of scale codes ticked in row N.
Q.row(N).selectedLabelsLabelListLabels for Q.row(N).selected.
Q.row(N).labelLabelThe row’s own label.
Q.row(N).allCodeSetThe full visible scale domain (same for every row).
Q.row(N).allLabelsLabelListLabels for the visible scale domain.
Q.row(N).answeredboolTrue once row N has at least one selection.
Q.row(N).notAnsweredboolInverse.

Methods

Question methods

ExpressionReturnsMeaning
Q.reset()NoneClear every row.
Q.row(N)RowObjectReturns a row proxy for row code N.
Q.at(N)RowObjectSame as Q.row(N).

Q.set({...}) accepts a bulk-update form for setting many rows at once. See Advanced below.

Row methods

ExpressionReturnsMeaning
Q.row(N).set([1, 2])NoneSet row N’s selection to a list of scale codes. Replaces whatever was there.
Q.row(N).add(M)NoneAdd scale code M to row N’s existing selection.
Q.row(N).reset()NoneClear row N.
Q.row(N).col(M)CellObject(Advanced) cell-level proxy for the (row, scale) intersection.

Collection operations

Q.row(N).selected and Q.row(N).selectedLabels are collections, plus the question-level Q.all/Q.allLabels. Standard ops apply:

ExpressionReturnsMeaning
Q.row(N).selected.sizeintNumber of scale codes ticked in row N.
Q.row(N).selected.any(M)boolTrue if row N ticked code M. The most-used routing pattern.
Q.row(N).selected.any([2, 3])boolTrue if row N ticked any of the listed codes.
Q.row(N).selected.every([1, 2])boolTrue if row N ticked all the listed codes.
Q.row(N).selected.intersect([2, 3])CodeSetNew collection of overlap.
Q.row(N).selected.union(other)CodeSetCombine collections.
Q.row(N).selected.minus([99])CodeSetSelection minus the listed codes.
Q.all.sizeintNumber of visible rows.

For aggregate counts (“how many rows ticked code N?”) write a script: sum(1 for c in Q.all if Q.row(c).selected.any(N)).

Skins

Three visual styles. Pick by row count, label length, and device.

checkboxGrid Checkbox grid (default)
MonTueWedThu
Email
Phone
SMS
Classic matrix table with checkboxes. Best on desktop where the column labels fit horizontally.
cardStack Card stack
Email
Mon Tue Wed Thu
Phone
Mon Tue Wed Thu
Each row becomes its own card with the scale as toggleable chips. Best on mobile.
chipGrid Chip grid
Email
Mon Tue Wed Thu Fri
Phone
Mon Tue Wed Thu Fri
Compact row-by-row layout with chips per scale point. Good middle ground for medium row counts.

The exact appearance is driven by theme tokens — colours, radii, fonts. See Customisation and Skin variants.

See it work

A working preview. Tick cells and watch the Live state panel.

Mockup preview
QFeatures gridmulti
Which features do you use on each device?
Tick all that apply per device.
Live state
QFeatures.answeredFalse
QFeatures.valueNone
QFeatures.selected{}
QFeatures.selectedLabelNone
QFeatures.selected.size0
Live state
QFeatures.answeredFalse
QFeatures.row(1).selected{}
QFeatures.row(1).selected.size0
QFeatures.all.size0
- qid: QFeatures
    type: gridMulti
    text: Which features do you use on each device?
    instruction: Tick all that apply per device.
    options:
        1: Phone
        2: Tablet
        3: Desktop
    scale:
        1: Voice search
        2: Maps
        3: Camera
        4: Calendar

The state panel shows row 1’s selection live — the playground below has the full per-row view.

Methods & accessors — live

Tick cells and watch each expression evaluate.

Mockup preview
QFeatures gridmulti
Tick all that apply per row.
Methods & accessors — live
QFeatures.answered → —
QFeatures.row(1).selected → —
QFeatures.row(1).selected.size → —
QFeatures.row(1).answered → —
QFeatures.row(1).label → —
QFeatures.row(1).selected.any(3) → —
QFeatures.row(1).selected.any([1, 2]) → —
QFeatures.row(1).selected.every([1, 2]) → —
QFeatures.row(2).selected.intersect([1, 2, 3]) → —

A few things to notice:

  • Q.row(N).selected is a collection per row, not a single code. .size is the count of ticks in that row; .any(M) / .every([list]) / .intersect(...) all work as expected.
  • There’s no question-level Q.selected. To answer “did any row tick code N?”, walk Q.all: any(Q.row(c).selected.any(N) for c in Q.all).
  • Q.row(N).label is the row’s own label (e.g. “Phone”); scale labels live on the scale entries, accessed via Q.row(N).allLabels.

Examples

”Tick at least 2 per row”

- qid: QChannels
    type: gridMulti
    text: Where do you use each channel?
    min: 2
    options:
        1: Email
        2: Phone
        3: SMS
    scale:
        1: At home
        2: At work
        3: On the go
        4: Don't use

min: 2 applies to every row. The respondent must tick at least two scale points for each row.

”None of these” exclusive scale entry

- qid: QFeatureUse
    type: gridMulti
    text: Which features matter on each device?
    options:
        1: Phone
        2: Tablet
        3: Desktop
    scale:
        1: Voice search
        2: Maps
        3: Camera
        4:
            label: Don't use any
            exclusive: True

Picking code 4 on a row clears the other ticks in that row only. Exclusive scale items scope per row, not across rows.

Per-row routing

- qid: QChannels
    type: gridMulti
    options: channelList
    scale: contextScale

- qid: QPhoneFollow
    type: open
    text: Tell us about your phone usage.
    if: QChannels.row(2).selected.any([1, 2, 3])    # row 2 = Phone
    style: textarea

QPhoneFollow only shows when row 2 (Phone) has at least one non-”Don’t use” selection. The grid’s per-row routing makes this trivial.

Aggregate count across rows

- qid: QFeatures
    type: gridMulti
    options: deviceList
    scale: featureList

- qid: hVoiceUsers
    type: number
    visibility: hide
    readonly: True
    required: False

- script: |
    # Count devices where the respondent ticked Voice search.
    voice = sum(1 for c in QFeatures.all if QFeatures.row(c).selected.any(1))
    hVoiceUsers.set(voice)

hVoiceUsers exports as a clean count for cross-tabbing — number of devices used for voice across all rows.

Pipe a row’s selected labels

- qid: QFeatures
    type: gridMulti
    options: deviceList
    scale: featureList

- qid: QPrimary
    type: open
    text: You said your Phone is used for {{ QFeatures.row(1).selectedLabels }}. Which is most important?
    if: QFeatures.row(1).answered
    style: text

row(N).selectedLabels stringifies as "Voice search", "Maps" for piping. Use selectedLabels.at(0) for just the first.

Validation example

- qid: QFeatures
    type: gridMulti
    text: Which features matter on each device?
    options: deviceList
    scale: featureScale
    validation: |
        # Require at least one tick on the Phone row specifically.
        if not QFeatures.row(1).answered:
            fail("Please tick at least one feature for Phone.")
        # And reject "Don't use" combined with another tick on the same row.
        for c in QFeatures.all:
            sel = QFeatures.row(c).selected
            if sel.any(99) and sel.size > 1:
                fail("If you tick 'Don't use any', untick the others on that row.")
                break

Custom validation can target specific rows or walk every row.

Advanced

Bulk Q.set({…}) — set many rows in one call

The everyday way to write a gridMulti from a script is per-row (QFeatures.row(1).set([1, 2])). When a script has values for many rows ready at once, the bulk form applies them in one go:

QFeatures.set({
    1: [1, 2, 3],   # row 1: codes 1, 2, 3
    2: [2, 4],      # row 2: codes 2, 4
    3: [],          # row 3: cleared
})
QFeatures.set({})    # clear every row

Object keys are row codes; values are lists of scale codes for each row. Unknown row or scale codes throw.

Why bulk set exists

Same rationale as on gridSingle — atomicity (whole payload validates together), mirroring data from another source, derived state computed from other questions, and a small performance edge in hot scripts. Prefer the per-row form for one or two writes.

Example — copy a previous-wave grid forward

- qid: QPrev
    type: gridMulti
    options: deviceList
    scale: featureList

- qid: QCurrent
    type: gridMulti
    options: deviceList
    scale: featureList

- script: |
    # Pre-fill the current-wave grid with what the respondent said
    # last time. They confirm or adjust.
    payload = {
        c: list(QPrev.row(c).selected)
        for c in QPrev.all
        if QPrev.row(c).answered
    }
    QCurrent.set(payload)

Cell-level access — Q.row(N).col(M)

For inspecting individual (row, scale) intersections without touching the surrounding row, use Q.row(N).col(M) — returns a cell proxy whose primary accessor is .selected (a bool).

if QFeatures.row(1).col(3).selected:
    # row 1 (Phone) ticked code 3 (Camera)
    print("Phone uses Camera")

In practice this is rarely worth using over Q.row(N).selected.any(M) — but it exists for code that wants to read or write a specific cell explicitly.

Export

gridMulti fans out to one column per (row, scale) intersection:

WhatColumn
Row N, scale code M ticked?qidrNoM (e.g. QChannelsr1o2)

Each column is tri-state:

ValueMeaning
1The cell was shown to the respondent and ticked.
0The cell was shown to the respondent and not ticked.
nullThe cell was not shown — masked by options.from / scale.from, or skipped via if.

The distinction matters whenever you mask rows or columns at runtime. See Tri-state projection.

See also