Question type

gridSingle

A grid where every row gets one selection from a shared scale. Rating tables, satisfaction matrices, agreement scales, semantic differentials.

What gridSingle is

gridSingle shows a table with one row per item and one column per scale point. Each row stores one selected scale code. Common shape: items down the rows, a Likert-style scale across the columns. The two domains are independent — options (or group) defines the rows, scale defines the columns.

Mockup preview
QSatisf gridsingle
How satisfied are you with each?
One answer per row.
- qid: QSatisf
    type: gridSingle
    text: How satisfied are you with each?
    instruction: One answer per row.
    options:
        1: Service
        2: Price
        3: Reliability
        4: Selection
    scale:
        1: Very dissatisfied
        2: Dissatisfied
        3: Neutral
        4: Satisfied
        5: Very satisfied

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typegridSingleRequired.
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.
styleradioGrid | paired | scaleButtons | cardStack | emojiScale | sliderGrid | bipolarSlider | scaleBarDefault radioGrid. See Styles below.
orderkeyword or expressionRow order. Keywords: fixed (default), random, randomEach, alphabetical, reverse, flip. Also accepts an expression (e.g. Q1.all). scale.order takes the same forms for columns. See 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: at the top, at the bottom, at both ends, or pinned (sticky) so it stays visible while the respondent scrolls.
scale.repeat.everyinteger (≥ 1)Cadence for the repetition — 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.
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.
Two domains, two filters. options.from filters which rows are shown to a respondent (e.g. only ranked brands); scale.from filters which scale columns are shown (e.g. drop “Don’t know” if a previous answer ruled it out). They’re independent.

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.
left.labelrenderableUsed with style: paired or style: bipolarSlider. The label at the left end of this row’s scale (or slider).
right.labelrenderableUsed with style: paired or style: bipolarSlider. The label at the right end of this row’s scale (or slider).
isolateTrue | FalseDefault False. Turns the row into a whole-question opt-out — see Isolate opt-out below.
exclusiveTrue | FalseDefault False. Pairs with isolate: True: selecting the opt-out clears + disables every scale cell and satisfies required.

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.

Methods & accessors

Accessors

Question accessors

ExpressionReturnsMeaning
Q.valuesCodeListSelected scale codes per row, in row order. null for unanswered rows.
Q.selectedCodeSetDeduplicated set of scale codes used across all rows. Useful for “did the respondent ever pick code N?”.
Q.allCodeSetAll visible row codes (the row domain).
Q.allLabelsLabelListLabels for Q.all.
Q.answeredboolTrue if any row has a selection.
Q.notAnsweredboolInverse.

Row accessors

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

ExpressionReturnsMeaning
Q.row(N).valueCodeThe scale code chosen for row N. None if the row is unanswered.
Q.row(N).selectedCodeSetCollection containing the row’s chosen scale code (size 0 or 1).
Q.row(N).selectedLabelLabelThe display label of the chosen scale code. None if unanswered.
Q.row(N).labelLabelThe row’s own label (the option label, not the scale).
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 a 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(M)NoneSet row N to scale code M.
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.selected, Q.values, Q.all, Q.allLabels, and the per-row Q.row(N).selected are all collections. Standard ops apply:

ExpressionReturnsMeaning
Q.row(N).selected.any(M)boolTrue if row N chose scale code M. The most-used routing pattern.
Q.row(N).selected.any([3, 4, 5])boolTrue if row N’s answer is in the listed range.
Q.selected.any(M)boolTrue if any row chose code M.
Q.values.sizeintNumber of visible rows (the row domain size).
Q.all.sizeintSame as Q.values.size.

For “how many rows answered” use a script: sum(1 for c in Q.all if Q.row(c).answered).

Skins

Seven visual styles, each suited to a different context — desktop matrix, mobile cards, sentiment scales, sliding scales, semantic differentials.

radioGrid Radio grid (default)
1234
Service
Price
Reliability
Classic matrix table — items down the rows, scale across the columns. Best on desktop.
paired Paired
Cheap Expensive
1 2 3 4 5
Slow Fast
1 2 3 4 5
Discrete scale anchored by left.label / right.label per row. The discrete sibling of bipolarSlider — use an odd-item scale when neutral is meaningful.
scaleButtons Scale buttons
Service
1 2 3 4
Price
1 2 3 4
Row label + scale button bar per row. Touch-friendly, slightly more vertical than a matrix.
cardStack Card stack
Service
1 2 3 4
Price
1 2 3 4
Each row becomes its own card with inline scale buttons underneath. Best on mobile.
emojiScale Emoji scale
Service
😞 😕 🙂 😀
Price
😞 😕 🙂 😀
Emoji-labelled scale per row. Use for sentiment, satisfaction, mood. Pair with emoji label entries on the scale.
sliderGrid Slider grid
Service
Price
Reliability
Range slider per row. Best when the scale is numeric and continuous (e.g. 0–10).
bipolarSlider Bipolar slider
Cheap
Expensive
Generic
Distinct
Semantic differential — slider centred at neutral with left.label / right.label per row. Use an even-item scale.
scaleBar Scale bar
Service
1 2 3 4 5
Price
1 2 3 4 5
All scale points as a single tappable pill bar per row. Best for short scale labels and mobile.

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

See it work

A working preview. Pick a scale point on each row and watch the Live state panel.

Mockup preview
QFeatures gridsingle
Rate each feature.
One answer per row.
Live state
QFeatures.answeredFalse
QFeatures.valueNone
QFeatures.selected{}
QFeatures.selectedLabelNone
QFeatures.selected.size0
Live state
QFeatures.answeredFalse
QFeatures.values{}
QFeatures.selected{}
QFeatures.all.size0
- qid: QFeatures
    type: gridSingle
    text: Rate each feature.
    instruction: One answer per row.
    options:
        1: Battery life
        2: Camera quality
        3: Screen size
    scale:
        1: Poor
        2: OK
        3: Good
        4: Excellent

The Live state panel shows values (one scale code per row, with null for unanswered) and selected (the deduplicated set of scale codes used). Pick the same code on two rows and notice selected is deduplicated; values keeps both.

Methods & accessors — live

Pick scale points on the rows below and watch each expression evaluate.

Mockup preview
QSatisf gridsingle
Rate each.
Methods & accessors — live
QSatisf.answered → —
QSatisf.values → —
QSatisf.selected → —
QSatisf.row(1).value → —
QSatisf.row(1).label → —
QSatisf.row(1).selectedLabel → —
QSatisf.row(1).answered → —
QSatisf.row(1).selected.any(4) → —
QSatisf.row(1).selected.any([3, 4]) → —
QSatisf.selected.any(1) → —

A few things to notice:

  • Q.row(N).selected.any(M) is the canonical routing pattern. “Did row 1 get rated 4?” reads as QSatisf.row(1).selected.any(4).
  • Q.row(N).label is the row’s label (“Service”); .selectedLabel is the chosen scale’s label (“Good”). Same word, different domain.
  • Q.values is per-row, in row order, with null for unanswered rows. Q.selected is the deduplicated set across all rows — useful for “was code 4 ever picked”.
  • The row-level .all returns the scale domain (same for every row). The question-level .all returns the row domain.

Isolate opt-out

Attach an isolate: True entry to the rows to give the respondent a “None of these apply / Prefer not to answer” toggle. It renders as a single checkbox below the matrix (never as a matrix row) and, when selected:

  • Clears + disables every cell in the grid — including the selected-highlight styling
  • Waives the per-row required gate so the respondent can proceed
  • Records once in the export as a flag column <qid>r<code> = 1 — excluded from the row × scale cross product, so no <qid>r99o* noise
- qid: QSatisfaction
    type: gridSingle
    text: How satisfied are you with each of these services?
    required: True
    options:
        1: Support quality
        2: Product reliability
        3: Documentation
        99:
            label: I don't use any of these
            isolate: True
            exclusive: True
    scale:
        1: Very dissatisfied
        2: Dissatisfied
        3: Neutral
        4: Satisfied
        5: Very satisfied

Pair isolate: True with exclusive: True to get the clear-and-null behaviour on the server — without exclusive, the toggle is a soft UI hint that the server won’t enforce. In practice you almost always want both together.

Read it in scripts with the standard row accessors:

if QSatisfaction.row(99).answered:
    # respondent opted out — main grid answers are null
    hOptedOut.set(1)

Top-box scoring

- qid: QSatisf
    type: gridSingle
    text: How satisfied are you with each?
    options:
        1: Service
        2: Price
        3: Reliability
    scale:
        1: Very dissatisfied
        2: Dissatisfied
        3: Neutral
        4: Satisfied
        5: Very satisfied

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

- script: |
    # Count rows where the respondent picked Satisfied or Very satisfied.
    top = sum(1 for c in QSatisf.all if QSatisf.row(c).selected.any([4, 5]))
    hTopBox.set(top)

hTopBox exports as a clean number — useful when downstream analysis wants top-2-box counts as a column.

Conditional follow-up per row

- qid: QSatisf
    type: gridSingle
    options: featureList
    scale: satisfactionScale

- qid: QWhyService
    type: open
    text: What would have made the service better?
    if: QSatisf.row(1).selected.any([1, 2])    # row 1 = Service, rated low
    style: textarea

QWhyService only shows when the respondent rated Service specifically as Dissatisfied or Very dissatisfied. The grid’s per-row routing makes this kind of targeting trivial.

Pipe a row’s chosen label

- qid: QSatisf
    type: gridSingle
    options: featureList
    scale: satisfactionScale

- qid: QHighlight
    type: open
    text: You said "{{ QSatisf.row(1).selectedLabel }}" for Service. Tell us why.
    if: QSatisf.row(1).answered
    style: textarea

row(N).selectedLabel returns the chosen scale’s label, which is usually what you want in piped text.

Mask scale columns at runtime

- qid: QFamiliar
    type: single
    text: How familiar are you with the brand?
    options:
        1: Not at all
        2: A little
        3: Very

- qid: QRate
    type: gridSingle
    text: Rate the brand on each.
    options: brandFeatures
    scale:
        1: Bad
        2: OK
        3: Good
        4: Excellent
        99: Don't know
    # Show "Don't know" only to respondents who said "Not at all" / "A little"
    scale.from: scaleBase if QFamiliar.selected.any(3) else scaleBase + [99]

scale.from filters the column dimension. The runtime expression returns a list of scale codes; only those columns render.

All-same detection (for data-quality flags)

- script: |
    # Flag straight-liners — same answer on every row.
    answered = [QSatisf.row(c).value for c in QSatisf.all if QSatisf.row(c).answered]
    if len(answered) >= 3 and len(set(answered)) == 1:
        hStraightLiner.set(1)
    else:
        hStraightLiner.set(0)

Useful for data quality flags downstream.

Validation example

- qid: QSatisf
    type: gridSingle
    text: Rate each.
    options: featureList
    scale: satisfactionScale
    validation: |
        # Don't accept the survey if Service is rated "Don't know" — we want a real opinion.
        if QSatisf.row(1).selected.any(99):
            fail("Please rate the Service item — pick a satisfaction level.")

Advanced

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

The everyday way to write a gridSingle from a script is per-row: QSatisf.row(1).set(4). When a script needs to write several rows at once, the bulk form is a single call:

QSatisf.set({1: 4, 2: 5, 3: 3})   # row 1 → 4, row 2 → 5, row 3 → 3
QSatisf.set({})                    # clear every row (alias for reset())

The keys are row codes; the values are scale codes. Unknown row or scale codes throw.

Why bulk set exists

For one or two rows the per-row form (QSatisf.row(1).set(4)) is fine. The bulk form earns its place when the script is doing aggregate work:

  • Atomicity. Every key in the object lands in one go. Either the whole payload validates and is applied, or none of it is — partial updates from a failing payload aren’t possible. Useful when several rows depend on each other.
  • Mirroring another data source. Pre-fill from a previous wave, copy from another grid, hydrate from JS-fed values. The script builds the object once and pushes it.
  • Computed-from-elsewhere answers. When a hidden grid’s every-row state is derived from other questions, building a dict and calling set() once reads cleaner than many per-row calls.
  • Performance in hot scripts. A single set() runs one validation pass instead of N. For a 30-row grid in a tight loop, that adds up.

If none of those apply, prefer the per-row form — it’s clearer at the call site.

Example — pre-fill from a previous wave

- script: |
    # `request.params` is the URL-fed context for this respondent.
    # Their previous wave's grid answer arrives as a JSON string.
    import json
    prev = json.loads(request.params.get("prev_satisf") or "{}")
    if prev:
        # Keys come in as strings; cast to int row codes.
        QSatisf.set({int(k): int(v) for k, v in prev.items()})

The respondent lands on the survey with their previous answers already filled in, ready to confirm or change. One call applies the whole grid.

Example — derive ratings from another question

- qid: QRank
    type: rank
    text: Rank these features.
    options: featureList
    exact: 5

- qid: hRatings
    type: gridSingle
    options: featureList
    scale: scoreScale
    visibility: hide
    readonly: True
    required: False

- script: |
    # Convert rank order to top-down scores: 1st → 5, 2nd → 4, ..., 5th → 1.
    payload = {}
    for i, code in enumerate(QRank.selected):
        payload[code] = 5 - i      # 5, 4, 3, 2, 1
    if payload:
        hRatings.set(payload)

hRatings becomes a gridSingle whose row-by-row scale codes are derived from the rank order — useful when downstream analysis wants both views and the rank is the primary capture.

Example — copy a grid forward

- qid: QPrevious
    type: gridSingle
    options: featureList
    scale: satisfactionScale

- qid: QCurrent
    type: gridSingle
    options: featureList
    scale: satisfactionScale

- script: |
    # Seed "Current" with the same answers the respondent gave for "Previous".
    # The respondent can then adjust where their satisfaction has changed.
    payload = {
        c: QPrevious.row(c).value
        for c in QPrevious.all
        if QPrevious.row(c).answered
    }
    QCurrent.set(payload)

A common pattern in trackers — let the respondent confirm or adjust their previous-period answers rather than retyping from scratch.

Anchored rows — paired and bipolarSlider

Two styles use per-row left.label / right.label to anchor each row’s scale with descriptive endpoints:

  • style: paired — discrete scale (radios or buttons) flanked by the two labels. Use an odd-item scale when neutral is a meaningful position.
  • style: bipolarSlider — continuous slider centred at neutral. Use an even-item scale so neutral isn’t a valid pick.

Both styles read the same per-row left.label / right.label props; the difference is whether the respondent picks a discrete option or slides a continuous control. The example below uses bipolarSlider; swap to style: paired (and an odd-item scale) for the discrete variant.

- qid: QPerception
    type: gridSingle
    text: Where does the brand sit on each dimension?
    style: bipolarSlider
    options:
        1:
            label: Quality
            left.label: Low
            right.label: High
        2:
            label: Price
            left.label: Cheap
            right.label: Expensive
        3:
            label: Brand
            left.label: Generic
            right.label: Distinctive
    scale:
        1: 1
        2: 2
        3: 3
        4: 4
        5: 5
        6: 6

The respondent sees a slider per row anchored between the two labels; the stored value is the scale code under the thumb.

Export

gridSingle exports one column per row — each holds the chosen scale code:

WhatColumn
Row N’s chosen scale codeqidrN (e.g. QSatisfr1) — number
Isolate opt-out activeqidr<code> = 1 (e.g. QSatisfr99) — one flag column, no scale cross product

Unanswered rows export as null. Masked rows (filtered by options.from) also export as null. When the isolate opt-out is active, every regular row column goes null and the flag column reads 1. See Tri-state projection.

See also