Question type

numberList

A column of numeric inputs, one per row. Useful for spending allocations, item-by-item ratings, lists of quantities. Supports running totals and aggregate sum constraints.

What numberList is

numberList shows a labelled row for each option, with a numeric input beside each one. Values can be constrained per-row (min / max) or in aggregate (sum). A running total can be shown to the respondent under the inputs.

Mockup preview
QSpend numberlist
How much do you spend per month on each?
- qid: QSpend
    type: numberList
    text: How much do you spend per month on each?
    label.prefix: $
    min: 0
    max: 5000
    options:
        1: Groceries
        2: Transport
        3: Entertainment
        4: Other

Properties

PropertyValuesNotes
qidstringRequired. Unique within the survey.
typenumberListRequired.
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.
styleinput | slider | sliderTicks | stepper | dropdownDefault input. See Styles below.
orderfixed | random | randomEach | flip | alphabetical | reverseDefault fixed. Row order.
group.ordersame as orderDefault fixed.
layout.colsintegerDefault 1.
label.positiondefault | left | rightDefault is left. Where the row label sits relative to the input.
minnumberNumeric lower bound for every row. No default.
maxnumberNumeric upper bound for every row. No default.
sumnumberValidation-only constraint on the total of entered visible row values. No default.
totalTrue | FalseDefault False. Set True to display a running-total row beneath the inputs. sum alone does not auto-show it.
decimalTrue | FalseDefault False. Set True to allow fractional values.
decimal.placesintegerCap precision when decimal: True. No default.
label.prefixstringDecoration on the left of every row’s input (e.g. $).
label.suffixstringDecoration on the right (e.g. %, kg).
input.sizeintegerWidth of every row’s input field, in characters. No default — sizes itself to the container.
input.headerstringOptional column header label shown above the input column.
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.
customcode blockCustom runtime block. No default.
dataobjectMetadata object for advanced authoring (custom code can read it). No default.

Skin-specific properties

These properties only have effect under a specific style:.

PropertyUsed withValuesNotes
stepper.stepstyle: steppernumberIncrement per − / + press. Default 1.
slider.ticksstyle: sliderTicksconfigurationTick-mark configuration along each row’s slider.
min / max here bound the value, not row counts. Unlike multi / openList where these are selection counts, on numberList they’re numeric bounds applied to every row.

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 to that row alone.

PropertyValuesNotes
labelrenderableRequired when expanding the row.
anchorTrue | FalseDefault False. Pin in place under order: random.
isolateTrue | FalseDefault False. Render this row in a separate group, outside the main list. Combine with exclusive: True to clear other answered rows when this one is filled.
exclusiveTrue | FalseDefault False. Filling this row clears every other row’s answer.
- qid: QHours
    type: numberList
    text: Hours per week on each activity.
    options:
        1: Work
        2: Sleep
        3: Exercise
        4: Other
        99:
            label: Not applicable
            isolate: True
            exclusive: True
            anchor: True

The first four rows are plain string labels. The “Not applicable” row expands to a map so it can carry isolate (renders below the main list), exclusive (clears the others when filled), and anchor (always last).

Methods & accessors

Accessors

Question accessors

ExpressionReturnsMeaning
Q.valuesNumberListCollection of all row values, in row order. Unanswered rows are null, not 0. sum(Q.values) treats null as zero for aggregation, but scripts that loop over the values directly need to handle null (e.g. [v for v in QSpend.values if v is not None]).
Q.allCodeSetCollection of all visible row codes.
Q.allLabelsLabelListCollection of row labels, parallel to Q.all.
Q.answeredboolTrue if any row has a value.
Q.notAnsweredboolInverse of answered.

Row accessors

Q.row(N) returns a row proxy with these accessors:

ExpressionReturnsMeaning
Q.row(N).valuenumberThe number entered in row N. None when unanswered.
Q.row(N).labelLabelThe row’s display label.
Q.row(N).answeredboolTrue once row N has a value.
Q.row(N).notAnsweredboolInverse.

Methods

Question methods

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

Q.set(...) also accepts a bulk-update form for setting multiple rows at once. See Advanced below.

Row methods

ExpressionReturnsMeaning
Q.row(N).set(N)NoneSet row N to a number.
Q.row(N).reset()NoneClear row N.

Collection operations

Q.values, Q.all, and Q.allLabels are collections, so they support the standard ops:

ExpressionReturnsMeaning
Q.values.sizeintNumber of visible rows (the domain size).
Q.values.at(0)numberFirst row’s value, in row order.
Q.all.sizeintNumber of visible row codes — same as Q.values.size.
Q.all.any(N)boolTrue if row code N is in the visible domain.
sum(Q.values)numberBuilt-in Python sum() works on the values collection — gives the total of all row values. Same shape the platform uses internally for sum: validation.

Skins

Five visual styles. Pick by the value range, the device, and how the respondent should interact with each row.

input Input (default)
Groceries 100
Transport 50
Plain numeric input field per row. Default. Best for any open numeric value where the respondent should type.
slider Slider
Service
Price
Range slider per row. Best for bounded continuous values across rows.
sliderTicks Slider + Ticks
Service
Price
Slider with tick marks per row. Good when the same scale (e.g. 1–10) applies to every row.
stepper Stepper
Adults
− 2 +
Children
− 1 +
− / + buttons per row. Best for small integer counts on mobile.
dropdown Dropdown
Service
8 ▾
Price
5 ▾
Numeric select per row. Useful when the same short range applies to every row.

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

See it work

A working preview. Type values into one or more rows and watch the Live state panel.

Mockup preview
QAllocate numberlist
Allocate 100 points across these dimensions.
Live state
QAllocate.answeredFalse
QAllocate.valueNone
QAllocate.selected{}
QAllocate.selectedLabelNone
QAllocate.selected.size0
Live state
QAllocate.answeredFalse
QAllocate.values{}
sum(QAllocate.values)0
QAllocate.all.size0
- qid: QAllocate
    type: numberList
    text: Allocate 100 points across these dimensions.
    sum: 100
    total: True
    options:
        1: Service
        2: Price
        3: Reliability
        4: Brand

The YAML adds sum: 100 and total: True — the platform shows a running total to the respondent and rejects the submission unless the total equals 100.

Methods & accessors — live

Type values into the rows below and watch each expression evaluate.

Mockup preview
QSpend numberlist
Monthly spend, in dollars.
Methods & accessors — live
QSpend.answered → —
QSpend.values → —
sum(QSpend.values) → —
QSpend.values.size → —
QSpend.row(1).value → —
QSpend.row(2).value → —
QSpend.row(1).label → —
QSpend.row(1).answered → —

A few things to notice:

  • Q.values is a collection of numbers and nulls, one per visible row, in row order. Numbers when filled, null when unanswered. Use sum(Q.values) for totals (treats null as zero) or filter explicitly when looping: [v for v in QSpend.values if v is not None].
  • Q.row(N).value is a number when answered, None when blank. Compare numerically: if QSpend.row(1).value > 100.
  • sum(Q.values) is the natural way to read the running total — Python’s built-in sum() works directly on the collection.
  • Q.values.size is the row count, not the count of filled rows. For “how many rows are filled?” walk Q.all: sum(1 for c in Q.all if Q.row(c).answered).

Examples

Allocation with sum: 100

- qid: QAllocate
    type: numberList
    text: Allocate 100 points across these dimensions.
    sum: 100
    total: True
    min: 0
    max: 100
    options:
        1: Service
        2: Price
        3: Reliability
        4: Brand

sum: 100 is enforced at submission. total: True shows a running total under the inputs so the respondent can see how close they are to the target. min: 0 / max: 100 apply to every row.

Per-item ratings

- qid: QRatings
    type: numberList
    text: Rate each on a 0–10 scale.
    style: slider
    min: 0
    max: 10
    options:
        1: Service
        2: Price
        3: Reliability
        4: Brand

style: slider renders a range slider per row — natural for 0–10 / 1–7 / 1–5 rating scales applied to several items in a row.

Time use

- qid: QHours
    type: numberList
    text: Hours per day on each activity.
    sum: 24
    total: True
    min: 0
    max: 24
    label.suffix: hours
    options:
        1: Sleep
        2: Work
        3: Eat
        4: Other

The values must add to 24. label.suffix: hours decorates every row’s input.

Hidden running total

- qid: QSpend
    type: numberList
    text: Monthly spend.
    label.prefix: $
    min: 0
    options:
        1: Groceries
        2: Transport
        3: Entertainment

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

- script: |
    hTotal.set(sum(QSpend.values))

hTotal exports as a clean single column for analysis without forcing the respondent to see a running total — useful when the total is for downstream cuts but not the survey itself.

Row dominance check

- qid: QSpend
    type: numberList
    text: Spending by category.
    sum: 100
    total: True
    options:
        1: Important
        2: Less important
        3: Least important
    validation: |
        if QSpend.row(1).value < QSpend.row(2).value:
            fail("The 'Important' row must score higher than 'Less important'.")

Validation blocks can compare row values directly — the typical use when allocations imply an order.

Hidden bucket helper

- qid: QSpend
    type: numberList
    text: Monthly spend.
    label.prefix: $
    options:
        1: Online
        2: In-store

- qid: hOnlineHeavy
    type: single
    options:
        1: Yes
        2: No
    visibility: hide
    readonly: True
    required: False

- script: |
    online = QSpend.row(1).value or 0
    instore = QSpend.row(2).value or 0
    if online + instore > 0 and online / (online + instore) > 0.7:
        hOnlineHeavy.set(1)
    else:
        hOnlineHeavy.set(2)

Q.row(N).value returns None for unanswered rows; the or 0 pattern provides a safe default for arithmetic. hOnlineHeavy gives analysts a clean categorical column derived from the raw spend values.

Validation example

- qid: QHoursPerWeek
    type: numberList
    text: Hours per week on each.
    sum: 40
    total: True
    min: 0
    max: 40
    options:
        1: Strategy
        2: Operations
        3: Admin
    validation: |
        for code in QHoursPerWeek.all:
            row = QHoursPerWeek.row(code)
            if row.answered and row.value < 0:
                fail("Hours can't be negative.")
        if sum(QHoursPerWeek.values) != 40:
            fail("Hours must add up to 40.")

min: 0 already prevents negative entries at the input level; the explicit validation: block adds a clean message and a custom total check (here equivalent to sum: 40, but useful when the rule is more nuanced).

Advanced

Patterns that programmers reach for less often.

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

The everyday way to write a numberList from a script is per-row: QSpend.row(1).set(100). When a script computes several values at once and wants to apply them as a single update, Q.set({...}) takes an object keyed by row code:

QSpend.set({1: 100, 2: 50, 3: 25})   # set rows 1, 2, 3 in one call
QSpend.set({})                        # clear every row (alias for reset())

Why use it? Bulk updates are atomic and slightly faster in a hot script — useful when carrying values across questions or mirroring state.

A worked example — copy values from one numberList to another:

- script: |
    payload = {}
    for code in QSource.all:
        if QSource.row(code).answered:
            payload[code] = QSource.row(code).value
    QTarget.set(payload)

Unknown row codes throw; non-numeric values throw. If you only need to set a single row, the per-row form (Q.row(N).set(N)) is clearer.

Export

numberList exports one column per row:

WhatColumn
Row N valueqidrN (e.g. QSpendr1, QSpendr2) — number

Empty rows export as null (different from openList which exports empty strings). Masked rows (filtered by options.from) also export as null. See Tri-state projection for the full distinction.

See also