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.
- 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
| Property | Values | Notes |
|---|---|---|
qid | string | Required. Unique within the survey. |
type | numberList | 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. |
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 the rows but can’t change the values. Pair with visibility: hide to fully hide a helper question. |
visibility | show | hide | Default show. |
style | input | slider | sliderTicks | stepper | dropdown | Default input. See Styles below. |
order | fixed | random | randomEach | flip | alphabetical | reverse | Default fixed. Row order. |
group.order | same as order | Default fixed. |
layout.cols | integer | Default 1. |
label.position | default | left | right | Default is left. Where the row label sits relative to the input. |
min | number | Numeric lower bound for every row. No default. |
max | number | Numeric upper bound for every row. No default. |
sum | number | Validation-only constraint on the total of entered visible row values. No default. |
total | True | False | Default False. Set True to display a running-total row beneath the inputs. sum alone does not auto-show it. |
decimal | True | False | Default False. Set True to allow fractional values. |
decimal.places | integer | Cap precision when decimal: True. No default. |
label.prefix | string | Decoration on the left of every row’s input (e.g. $). |
label.suffix | string | Decoration on the right (e.g. %, kg). |
input.size | integer | Width of every row’s input field, in characters. No default — sizes itself to the container. |
input.header | string | Optional column header label shown above the input column. |
options | list name or inline domain | Required when group: is not used. The rows. |
options.from | expression | Filter the visible rows at runtime. No default. |
group | grouped list name | Required when options: is not used. |
custom | code block | Custom runtime block. No default. |
data | object | Metadata object for advanced authoring (custom code can read it). No default. |
Skin-specific properties
These properties only have effect under a specific style:.
| Property | Used with | Values | Notes |
|---|---|---|---|
stepper.step | style: stepper | number | Increment per − / + press. Default 1. |
slider.ticks | style: sliderTicks | configuration | Tick-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:
| Property | Values | Notes |
|---|---|---|
options | grouped row entries | Required. |
show.label | True | False | Default True. Set False to hide the group header. |
anchor | True | False | Default 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.
| Property | Values | Notes |
|---|---|---|
label | renderable | Required when expanding the row. |
anchor | True | False | Default False. Pin in place under order: random. |
isolate | True | False | Default 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. |
exclusive | True | False | Default 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
| Expression | Returns | Meaning |
|---|---|---|
Q.values | NumberList | Collection 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.all | CodeSet | Collection of all visible row codes. |
Q.allLabels | LabelList | Collection of row labels, parallel to Q.all. |
Q.answered | bool | True if any row has a value. |
Q.notAnswered | bool | Inverse of answered. |
Row accessors
Q.row(N) returns a row proxy with these accessors:
| Expression | Returns | Meaning |
|---|---|---|
Q.row(N).value | number | The number entered in row N. None when unanswered. |
Q.row(N).label | Label | The row’s display label. |
Q.row(N).answered | bool | True once row N has a value. |
Q.row(N).notAnswered | bool | Inverse. |
Methods
Question methods
| Expression | Returns | Meaning |
|---|---|---|
Q.reset() | None | Clear every row. |
Q.row(N) | RowObject | Returns a row proxy for row code N (see Row accessors above). |
Q.at(N) | RowObject | Same as Q.row(N). |
Q.set(...) also accepts a bulk-update form for setting multiple
rows at once. See Advanced below.
Row methods
| Expression | Returns | Meaning |
|---|---|---|
Q.row(N).set(N) | None | Set row N to a number. |
Q.row(N).reset() | None | Clear row N. |
Collection operations
Q.values, Q.all, and Q.allLabels are collections, so they
support the standard ops:
| Expression | Returns | Meaning |
|---|---|---|
Q.values.size | int | Number of visible rows (the domain size). |
Q.values.at(0) | number | First row’s value, in row order. |
Q.all.size | int | Number of visible row codes — same as Q.values.size. |
Q.all.any(N) | bool | True if row code N is in the visible domain. |
sum(Q.values) | number | Built-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) slider Slider sliderTicks Slider + Ticks stepper Stepper dropdown Dropdown 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.
QAllocate.answeredFalseQAllocate.valueNoneQAllocate.selected{}QAllocate.selectedLabelNoneQAllocate.selected.size0QAllocate.answeredFalseQAllocate.values{}sum(QAllocate.values)0QAllocate.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.
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.valuesis a collection of numbers andnulls, one per visible row, in row order. Numbers when filled,nullwhen unanswered. Usesum(Q.values)for totals (treatsnullas zero) or filter explicitly when looping:[v for v in QSpend.values if v is not None].Q.row(N).valueis a number when answered,Nonewhen blank. Compare numerically:if QSpend.row(1).value > 100.sum(Q.values)is the natural way to read the running total — Python’s built-insum()works directly on the collection.Q.values.sizeis the row count, not the count of filled rows. For “how many rows are filled?” walkQ.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:
| What | Column |
|---|---|
| Row N value | qidrN (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
- number — single numeric input.
- openList — same row shape, but text values.
- gridNumber — 2D numeric grid (rows × cols).
- Constraints —
sum,total,min/max. - Row & cell access —
.row(N)semantics. - Builtins & operators —
sum(), math functions.