Skip to content

Regions

A page is a list of regions. A region reads one table and renders it in one shape. Every region declares which table it is about, and can narrow the page’s access rule for itself. The one exception is compare: it reads two columns of the page’s record, so it names columns and no table.

page members "Members" {
route: /members
access: board
report of members "All members" {
columns: name, email, fee_group
search: name, email
sort: name
page_size: 25
}
}

Each property is written once per block. A second page_size: in the same report, or a second clear: in the same duplicate block, is a compile error at the second line, and the message gives the line of the first. A property that takes a list takes it on one line: columns: name, email, fee_group. This rule applies to every block: app, table, column, page, region, field, and access rule.

A region’s where condition can go on its first line, after the table and before the label. These two regions are the same:

list of events where published "Upcoming events" {
sort: starts_at
}
list of events "Upcoming events" {
where: published
sort: starts_at
}

Write the condition on the line when it is short and fits there. Write where: in the block when the condition is too long for the line. Do not write both: the compiler refuses a region that has both and gives the two places. report, list, stats, sheet, and the two axes of a matrix accept the condition on the line, because they accept where:. The other regions refuse it. The condition stops before the label, also when the condition ends in text: in report of events where kind = "talk" "Talks" the condition is kind = "talk" and the label is Talks.

A where: that reads a sensitive column, directly or through a ref or a var, needs a grant for every role that can read the region, as a note’s when: does. Which rows appear tells the reader something about the value, and a role without the grant would see that even though the column itself is left out of its cells. The compiler refuses the region and names the column. Give the region its own access: for the granted roles, or write the condition on a column that is not sensitive. A chart refuses such a where: for every role.

A region can list a relation of the page’s record

Section titled “A region can list a relation of the page’s record”

On a page with a data record, a region can name a relation column of that record instead of a table. Write a colon, the record’s name, a dot, and the column. The table enrolments declares marks list(marks.enrolment), so these two regions are the same:

report of :enrolment.marks "Marks in this course" {
columns: assessment, points
}
report of marks "Marks in this course" {
where: enrolment = :enrolment.id
columns: assessment, points
}

The compiler turns the first region into the second. So everything the second region does, the first one does the same way: pagination, search, filters, sorting, exports and their addresses, row links, the empty text, the region’s own access, rows in a gone state, and grants. On a page whose access rule has a where filter, the region reads the page’s record, which is what the compiler requires of a region over another table.

report, list, stats, sheet, and the two axes of a matrix accept a relation. The column decides the condition:

Column on the record’s table The region lists Condition
marks list(marks.enrolment) marks enrolment = :enrolment.id
topics multi(topics) topics the topics linked to the record
courses list(courses.topics), over a multi courses the courses linked to the record

A where on the line or in the block narrows the relation further. For example, list of :enrolment.marks where published lists the published marks of the record.

A sheet over a list relation fills the reference of each row it adds, for example course with the record’s id. Do not write a set for that column; the compiler refuses it. A sheet over a multi relation, or over a list of a multi, cannot offer actions: add or actions: delete. A row of such a sheet is the linked row itself, not the link: a new row would not be linked to the record, and a removal would delete the row for every record that links it. Link and unlink rows in the form that has the multi field instead, and delete them on a page of their own.

The compiler refuses a relation in these cases, and each message gives the region to write:

  • a form, a detail, a versions region or a matrix itself (a matrix axis accepts one);
  • a one or a ref column, which holds one row: show it in the record’s detail;
  • a column that is not a list or a multi;
  • a record that the page does not declare, and :user or :route.

Three region kinds render rows in a table, and they differ in where the columns come from and whether a cell accepts typing:

Region Columns come from Editable Status
report the schema no shipped
sheet the schema yes shipped, save, add, and delete, in an editing grid
matrix the data not yet shipped, read-only

Every region kind accepts test_id: <name>. The name identifies the region for a test. The engine writes it into the page as a data-testid attribute on the element that holds the region: the section, article or figure that carries the region’s aria-labelledby.

list of events "Upcoming events" {
columns: title, starts_at
test_id: upcoming_events
}

This list is drawn as <section class="region" aria-labelledby="region-0-label" data-testid="upcoming_events">. A region without test_id: has no data-testid attribute. The engine does not make an id from the region’s position or label.

The name follows these rules. The compiler refuses a region that breaks one of them, and the message gives the line and the repair.

  • It starts with a lower-case letter and has only lower-case letters, digits and underscores: [a-z][a-z0-9_]*. It has at most 40 characters.
  • It is unique on its page. Two regions of one page cannot have the same name. The message gives the line of the first. Two pages can use the same name.
  • It is not a region kind: list, report, detail, form, stats, matrix, sheet, versions, compare, chart or calendar.
  • It is written once per region, without quotation marks.

A region has no label requirement: a region without a label can have a test_id:. A region that the visitor may not open is not drawn, so its data-testid is not in the page either.

test_id: has no effect on who can see a region, on its address or on its order. The engine uses it for no other purpose than writing the attribute.

A workflow test names the region with in region <test_id>: to read its text or count its rows, and, for a form, to say which of two forms of one table a fill is for. See Name a region and Choose the form of a fill.

Rows of one table, for reading. A report supports search, filters, sortable columns, pagination, export, row links, and an empty state. On a phone, each row shows its first column across the width, then the other labelled columns in two columns. Long values wrap, and the last column uses the full width when it has no partner.

Property Meaning
columns which columns, in which order
search columns that one search box searches
filter columns offered as filters
sort the initial order
page_size rows per page. Default: 25, unless the report has a limit:.
limit the most rows the report shows, with no pages. Not together with page_size.
where a fixed condition on top of the access rule
gone show lists the rows in a gone state, which are left out by default. See state.
export any of csv, xlsx, and ics, comma separated
group_by one to three keys. The report then shows one row per group of rows. See Grouped report.
total with group_by, the lines that a totals row adds up.
export_name the name in the export’s address. Default: the region’s table.
export_button true puts the downloads under their own Export control. Default false: they are in the menu of the first button.
striped true draws every second row on a faint background. Default false.
empty the text shown when there are no rows

In an ordinary report, list or sheet, columns: names columns of that region’s table. The compiler refuses a reference path such as student.name. Declare a computed column for the path and name it instead. A grouped report can show paths from its reference keys.

striped: true is the one property that changes only how a report looks.

report of members "Members" {
columns: last_name, first_name, fee, joined
striped: true
}

Use it on a wide table of short values: a band keeps the eye on one row while it reads across. Leave it off for a short table, or one whose cells hold sentences — there the band is noise. No rule can tell the two apart, so the engine does not guess.

striped: belongs to a report and to nothing else. A list draws cards and a detail draws one record, so neither has rows to alternate; the compiler refuses the property there and names the region that draws a table.

A report shows 25 rows per page when it has neither page_size: nor limit:. Write page_size: to change the number. Write limit: to show one screen of rows and no pages; a report may not have both.

The page number is part of the page’s address: page 2 is ?page=2, next to the search, the filters, and the sort. The Previous and Next links keep all of them, so page 2 of a filtered list is still filtered. Page 1 has no page number. A list that fits on one page shows no page links and no row count. A page number past the last page, or one that is not a positive whole number, gets a “not found” page.

A page can hold one paginated region, because an address has room for one page number. A report beside a list with page_size: is a compile error. Give the report a limit:, or give one of the two regions its own page.

Before 2026-09-26, page 2 was <route>/page/2. Those addresses still work: the engine redirects them to ?page=2.

A report draws one row between its heading and its table. The search box and the filters are on the left, and the region’s actions are on the right. When the report has no search box and no filter, the actions are in the region’s heading.

The filters are behind one Filters button. It opens a panel with one control for each column in filter:, and Apply reloads the list. The control depends on the column’s type:

Type Control Rows shown
enum, ref a checkbox for each value rows with any of the ticked values. No tick shows all rows.
date From and To date fields rows from the first day to the last day, both included. Leave one field empty to leave that end open.
bool All, Yes, or No all rows, only yes, or only no
other types a text field rows whose value is equal to the text

Two filters narrow together: a row must match both. A filter’s address is part of the page’s address, so a filtered list can be bookmarked. ?status=active&status=passive ticks two values, and ?joined_on.from=2026-01-01&joined_on.to=2026-03-31 sets a range. The engine ignores a value that the column cannot hold. Each filter that is set shows as a chip next to the button, for example Status: Active ×, and the button shows how many are set. A chip is a link to the same list without that filter: the search, the sort, and the other filters stay. Clear filters in the panel removes every filter and keeps the search. Enter in the search box submits the search together with the filters that are set.

The first button is the region’s primary action, and it is always visible. Every other action is in a menu that opens from the arrow beside it: the other buttons first, then the downloads.

report of members "Members" {
export: csv, xlsx
button "New member" -> member
button "Invite" -> invitation
}

This report shows New member with an arrow. The arrow opens a menu with Invite, CSV export, and Excel export. A report with only one button and no export shows the button without an arrow.

Write export_button: true to give the downloads their own Export control beside the primary action. Use it where readers download often, for example a report that somebody exports every month.

report of members "Members" {
export: csv, xlsx
export_button: true
button "New member" -> member
}

With one download format, the control is a single link, such as CSV export. With two, it is an Export menu. A report without a button always shows its downloads in this way. export_button: needs export: csv or export: xlsx. A calendar feed (export: ics) has its own block under the heading, so the compiler refuses export_button: on a region whose only export is ics.

The menus open and close without JavaScript. With JavaScript, Escape closes a menu, and so does a press outside it.

Write icon <name> after the label of a button or a row_action. The icon is drawn before the label. Add only to draw the icon without the label.

report of members "Members" {
button "New member" icon plus -> member
button "Import" icon upload only -> import
row_action "Edit" icon pencil only -> member
}

The name must be one of the icons. With only, the label is still required. It becomes the accessible name of the control and its tooltip, so a screen reader announces Edit. A button in the menu beside the primary action (see above) always shows its label. The menu draws the icon and ignores only. A row -> link has no label and takes no icon.

CSV, Excel and calendar exports accept at most 10,000 rows under the reader’s access rule and current search and filters. Above the cap, HTTP 422 returns a localized error page stating the cap and suggesting search or filters. No file is sent. A grouped report counts groups instead.

export: csv and export: xlsx each draw a download control. Neither implies the other. A CSV is the format a program reads; a workbook is the format a person opens, and its cells carry a type, so a number adds up and a date sorts in every locale. See Export a listing.

An export’s address is the page’s own address with ?mtd_export=<name> for a CSV and ?mtd_export=<name>.xlsx or ?mtd_export=<name>.ics for the other two. The name is the region’s table, so report of members { export: csv } is at ?mtd_export=members. The name does not change when you add a note or a region above the listing. This matters for a calendar, because a phone asks for the same address for years.

Write export_name: only when one page has two exports of the same table. The compiler refuses such a page and names the lines:

list of events "Upcoming" {
where: starts_at >= now
export: ics
at: starts_at
}
list of events "Past" {
where: starts_at < now
export: csv
export_name: past
}

The first list is at ?mtd_export=events.ics and the second at ?mtd_export=past. export_name: is one name without quotation marks. It cannot be a number or contain a dot, and it needs export:.

With export: ics, eleven more properties say how a row becomes a calendar entry. Each one names a column of the region’s table, except alarm_before and upcoming, which may read a value from the page, url, which takes one word, and url_note, which takes a sentence.

Property Column kind Entry
at date or datetime. Required with export: ics. when it starts
ends the same kind as at when it ends
place text the location
details text, long text, or markdown the description
repeat three columns: an enum over none/daily/weekly/monthly/yearly, an int, a date the repeating series, as one rule
upcoming an int column, :<data row>.<int column>, or :<var> how many dates of each series the entry carries, from the first that has not ended. 0, a negative number, or nothing sends every date. Needs repeat.
all_day bool a true row is a day with no time
alarm bool a true row may remind the reader. Absent means every row may.
alarm_before an int column, :<data row>.<int column>, or :<var> minutes before. 0, a negative number, or nothing sends no reminder.
url the word page the entry links back to the page
url_note a sentence in quotation marks written above that address in the description

A reminder is sent only when alarm and alarm_before both say yes. alarm: without alarm_before: is a compile error. all_day: beside a date at: is a compile error too. A date has already said that every row lasts all day. url_note: without url: is a compile error as well: there is no address for the sentence to introduce. So is upcoming: without repeat:, and alarm_before: or upcoming: reading a computed column of a data row: a page reads a data row’s stored columns only, so write the expression as a var and read that.

Status: a reminder in a subscribed calendar is honoured by Apple Calendar, ignored by Google Calendar, and handled differently by Outlook versions. See Export data for what to tell your readers.

The title of an entry is the table’s display. Which rows are in the calendar is the listing’s own query: the page’s access rule, the region’s where, and the reader’s filters.

Every column in columns is sortable. Sorting and filtering go through the compiled model. A request parameter never reaches SQL as text.

A row -> link and a row_action link are drawn only where the reader can open the target page with that row. The engine checks the target page’s access rule once, and the target’s row conditions for each row: its access filter, its data … where, and the access rule of a form or detail on it. The report still lists a row that the target page would not show. The row has no link, and its identity cell is plain text.

A link can open a page whose route has earlier parameters, such as /courses/{course}/enrolments/{enrolment}. The row fills each earlier parameter from its own ref columns. See A row link fills the earlier parameters.

A multi and a list cannot be columns. Both are sets of rows rather than values. Count one instead, or ask whether it is empty.

A report with group_by: shows one row per group of rows, and each row shows what the group adds up to. Use it for hours per consultant and month, or revenue per project. The region keeps everything else a report has: where, access, filter, search, sort, columns, page_size, limit, export, empty, gone and button ->. For a walk-through, see Show totals per month.

report of time_entries "Hours per consultant and month" {
group_by: employee, month(work_date) "Month"
column entries count "Entries"
column minutes_total sum(minutes) "Minutes" {
empty: zero
}
column hours_total decimal(2) "Hours" {
value: round(ratio(minutes_total, 60), scale: 2, ties: up)
}
columns: employee, month(work_date), hours_total, entries
sort: month(work_date) desc, employee
filter: work_date, project, billable
total: minutes_total, hours_total, entries
export: csv, xlsx
}

A group adds up the rows that the reader may read, and no others. The engine puts the page’s row filter, the region’s own row filter, the application scope, the gone rule, where:, filter: and search: in the WHERE of one statement, and groups the rows that statement returns. The region’s access: narrows the page’s rule, and both row filters apply. A manager whose rule reads the team’s entries therefore gets the team’s totals, and backoffice gets the company’s totals, from the same region. The count of groups, the totals row and the export read the same rows. A row in a gone state is left out unless the region says gone: show.

A key is a stored column that has a small, fixed set of values, or a part of a date:

Key The column must be The key’s value
<column> ref, enum, bool or date the column’s value
day(<column>), week(<column>), month(<column>), year(<column>) date the first day of the day, week, month or year. A week is an ISO 8601 week and starts on Monday.

The value of a bucket is a date, so it sorts in time order, and it is a date cell in a workbook. The page writes a month as “September 2026”, a week as “Week 40, 2026” and a day as a date, in the application’s language. A CSV file and a workbook carry the first day of the bucket.

A report has at most 3 keys, and each key is written once. A text column, a number and a datetime are not keys: they would make a group for almost every row. The bucket functions are for group_by:, columns: and sort: only. You cannot write them in a condition.

A key may have a caption after it in quotation marks, as in month(work_date) "Month". Without a caption, a key takes the caption of its column (employee is “Consultant” when the column is captioned so). A bucket takes the name of its bucket in the application’s language instead: Day, Week, Month or Year, or Tag, Woche, Monat and Jahr in German. The same header is used on the page, in the CSV file and in the workbook. The caption is translatable. An empty caption, a caption that two columns of the report share, and a caption on the group_by: of a stats region are compile errors.

A line is a column statement in the report’s block: column <name> <definition> "Label" { properties }. A report has at most 12 lines, and at least one. The definitions are count, sum, min, max, int, money and decimal.

Definition What the line shows Block
count the number of rows in the group where:
sum(<column>) the sum of a stored int, money or decimal column of the report’s table empty: (required), where:, weight:
min(<column>), max(<column>) the smallest or the largest value of such a column empty: (required), where:
int, money, decimal(n) a computed value over the lines above it value: (required)
  • empty: says what a group shows when no row matches the line’s where:: zero, or null for an empty cell. SQL has no default, so the compiler requires one. A count takes none.
  • where: narrows the rows of one line and is written in the vocabulary of the table. A line where: billable adds up only the billable minutes of each group.
  • weight: multiplies each value by a stored int or decimal column before a sum adds it.
  • A computed line has a value: over the lines above it. It uses integers, ratio and round. It cannot read a column of the table, a line below it, or a value from the request such as :user.id. Write that value in the where: of the sum that the line reads.
  • What a line shows comes from its definition. A sum of money is money. A sum of a decimal keeps its places, and a weighted sum has the places of the value plus those of the weight, at most 4. A computed line has the type that you declare.
  • There is no avg. Write a sum, a count, and a decimal line with value: round(ratio(total, rows), scale: 2, ties: up).

A line may not have the name of a column of the table. columns:, sort: and total: name keys and lines, while filter: and search: name columns of the table. A line named minutes over a column minutes would make one word mean two things. The compiler refuses it and suggests minutes_total. The caption of a line is translatable. Without a caption, the line shows its name.

Name keys and lines in the columns, the order and the totals
Section titled “Name keys and lines in the columns, the order and the totals”
Name Is Written in
employee, month(work_date) a key, as group_by: spells it columns:, sort:
project.customer a column of the row that a ref key points at columns:
hours_total a line columns:, sort:, total:
  • Without columns:, the report shows every key and then every line. Without sort:, it sorts by its keys, ascending. A sort: is always completed with the keys, so a group is never shown twice or skipped between two pages.
  • A stored column that is not a key cannot be in columns: or sort:. It has one value for each row, and the report has one row for each group.
  • Every column header sorts the groups. A reader’s ?sort= can name only a column of the report.
  • total: names the lines that the totals row shows. A count and a sum total by adding. A min and a max total by taking the smallest or the largest of all rows. A computed line totals by its own value: over the totals of the lines it reads, so its total is not the sum of the rounded values above it and can differ from that sum in the last place. A key has nothing to total. The table foot is a row with the word “Total” in the application’s language.
Filters and search select rows before they are grouped
Section titled “Filters and search select rows before they are grouped”

filter: and search: name columns of the table, for example filter: work_date, project, billable. They decide which rows are added up. Naming a line in them is a compile error, because a condition on a total is a HAVING, which a grouped report does not have. To see the large groups first, sort by the line.

  • The page shows 25 groups, unless the report has page_size: or limit:. The page number counts groups, and the totals row is over every group, not only the groups on the page.
  • export: csv and export: xlsx give the groups of every page, in the order of the page, and a last row with the totals when the report has total:. The word “Total” goes in the first shown column that has no total. A workbook has typed cells: integers, money, decimals with their places, and dates for a bucket. The export has no page window and has the same filters as the page. A file holds at most 10,000 groups. A larger report answers with HTTP 422 and a localized error page stating the cap and suggesting search or filters. No file is sent.
  • export: ics is a compile error: a group has no date of its own.
  • A key, the column of a line, a weight, a line’s where: or a ref path in columns: that reads a sensitive column compiles only when every role that can read the region has the grant. A group and its sums are shown whole to each reader. See Sensitive columns are granted per role.
  • A sum that does not fit in 64 bits is not shown as a number. The page shows “These numbers are too large to add up.” in the application’s language, and the export answers with an error page.
  • group_by: on a list (write a report), a column line outside a report, total: or a line without group_by:, and a group_by: with no line.
  • more than 3 keys, more than 12 lines, a key or a line written twice, and a line named like a column of the table.
  • a key or a line over a computed column, an aggregate column, a multi, a list, a one, an img or a file. A key that is a text, a number or a datetime.
  • a bucket of a datetime, or of anything but a date.
  • sum, min or max over anything but an int, money or decimal. empty: missing, or on a count. weight: on anything but a sum, or over a column that is not an int or decimal.
  • a computed line with no value:, or one that reads a column of the table, a line declared below it or a : value.
  • row -> and row_action: a group is not a row. button -> <page> is allowed.
  • filter: or search: that names a line.
  • export: ics.
  • a line’s where: that names a gone state without gone: show.

The same rows as a report, in a layout for reading rather than for administration. A list has no search box and no filters. Use a list for a public page, and a report for a screen that somebody works in.

A list shows every row it can read, or limit: rows. Write page_size: to show it in pages with the same ?page= links as a report. A list has no default page size.

One row, as a record. A detail shows fields in a metadata line rather than in cells, so it can show a multi or a list as a set of links. It is the right region for an article, a member file, or any page that is about one row.

Counts as tiles. A stats region groups a table and shows the totals. group_by: must name an enum (including a lifecycle state) or bool column. Each declared value gets a tile, including values with a count of zero. The compiler refuses any other group_by: column, points at the key, and names the repair:

  • A ref has no list of declared values, only the rows of its target. To count rows for each value of a ref, write a grouped report: group_by: <the ref> and the line column n count.
  • A date is counted by a grouped report with group_by: day(<the date>), or week, month or year, and the line column n count. A datetime cannot be a bucket yet: group by a date column.
  • A text, email, slug, int, money or decimal column has no list of values. Declare it as an enum or a bool, or list the rows in a report with filter: <the column>. A grouped report cannot use these kinds as a key either.
  • A sensitive column cannot be the key: a stats count checks no grant. Use a grouped report with grants: to show the count to the roles that may read the column.

A stats region leaves out the rows in a gone state, and it shows no tile for a gone state. Write gone: show to count them:

stats of posts "Posts by status" {
group_by: status
gone: show
}

See state.

One total per group, drawn as columns, bars or a line. A chart reads one table, groups its rows by one key (x) or by two (x and by), and draws one number for each group. The server draws the picture as SVG, without JavaScript. The same numbers stand in a table behind it, in a closed Table control that a screen reader and a keyboard reach.

chart of members "Members joined per month" {
access: board
x: month(joined_on)
y: count
by: status
last: 12
empty: "Nobody has joined in the last year."
}

The block takes these properties, each written once and each on its own line.

Property Meaning Default
x The key that groups the rows. day(c), week(c) (ISO 8601, weeks start on Monday), month(c) or year(c) of a stored date or datetime column, or a stored enum, bool or ref column. required
y What each group shows. count, or sum(c), min(c) or max(c) of a stored int, decimal or money column. A decimal keeps its places: the axis, the titles and the table show sum, min and max of a decimal(2) with two places, in the reader’s notation. required
by An enum or bool column with at most 4 values. One series for each value, in the order of the declaration. none
kind columns (vertical), bars (horizontal) or line. columns for a time x, bars otherwise
stack true or false. It needs by:. true piles the series of one group on each other. true with by: on a count or sum, else false
last How many time buckets to draw, 1 to 60. The last one holds today. required with a time x, refused otherwise
top With a ref x: how many targets to draw, 1 to 12. The rest are folded into “Other”. 8
where A fixed condition, as on a report. none
access A rule that narrows the page’s rule, as on a report. the page’s rule
empty The text shown when no row matches. “No entries available.”

The model holds every default, so the compiled model shows the kind, stack, last and top that the engine draws.

y: takes a block for sum, min and max. It holds empty: and, on a sum, weight:, each on its own line:

chart of line_items "Revenue by kind" {
x: kind
y: sum(unit_price) {
weight: quantity
empty: zero
}
}
Property of the y block Meaning
empty zero or null. Required on sum, min and max. It is the value of a bucket that has no rows.
weight An int column. Each value is multiplied by it before the total is added up. sum only.

A count has no block, because a count of no rows is 0. There is no avg: the language has no division. See sum, min and max for the same rule on a column.

A chart reads the rows that a report of the same table would read, in this order of narrowing:

  • the page’s access rule, and the chart’s own access:;
  • the chart’s where:;
  • the page’s row filter, and the app scope when the table has one.

A chart leaves out the rows in a gone state. It has no gone: show, and a where: that names a gone state of its own table is a compile error. An enum value that is a gone state gets no column, no bar and no series.

A reader who may not see the chart does not see that it exists: the region is absent from the page. A chart does not follow the search and filters of a report on the same page. Its where: describes its rows. A where: may use the route’s own row parameters, such as where: event = :event.id, and nothing else from the request.

A row with no value in x is not counted. A row outside the last buckets is not counted.

Buckets are cut in one time zone: the page’s timezone: when it names a fixed zone, and otherwise the application’s. A page with timezone: user still cuts its charts in the application’s zone, because a bucket that moved with the reader would give two readers two totals for “March”. The caption of a chart names the zone, such as “Months in Europe/Berlin”, on a page that shows a zone indicator. Stored values stay UTC. See timezone.

The engine builds the list of buckets before it reads the rows. A bucket without rows is drawn and is not skipped. It shows 0 for a count, and for sum, min and max it shows what empty: says. empty: zero draws 0. empty: null draws no mark, shows “—” in the table, and breaks a line at that bucket.

A value axis always includes 0. A negative value grows downward, or to the left in bars. A stack piles its positive values above 0 and its negative values below it. A value that is not 0 is always at least 2 of 1,000 drawing units long, so a small value stays visible.

With a ref x, each target is one bucket, labelled with the target’s display. The chart ranks the targets by their total, largest first. Equal totals go by display text, then by id. It draws the first top: targets.

  • For a count or a sum, the other targets are folded into one last bucket, “Other”.
  • For a min or a max, no honest “Other” exists. The other targets are left out, and a line under the chart says how many, such as “3 more not shown.”

With by: the chart has a legend. Colour is never the only sign. In columns and bars, series 3 is a diagonal hatch and series 4 a dot texture. In a line, the four series are a solid, a dashed, a dotted and a dash-dot stroke.

The colours come from one scale that runs from deep blue through purple to amber. A chart takes as many steps of it as it has series, spread over the whole scale: one series is blue, two are blue and amber, three are blue, purple and amber, and four add the two steps in between. The steps differ in the light and the dark scheme so that each stays readable on its background. The tenant’s accent colour is not used. In bars, the value stands at the end of each bar. Every mark has a title with its bucket, series and value. With JavaScript on, moving the pointer over a chart shows a small box at once. It names the bucket and lists each series with its colour and value. Tapping a chart shows the box on a touch screen; Escape or a tap outside closes it. Without JavaScript the browser shows the title after a short delay.

With more than 12 buckets, the chart writes every second label (13 to 24 buckets) or every sixth (25 to 60). The first and the current bucket always have a label.

A total that does not fit in a 64-bit integer is not drawn. The region shows the note “These numbers are too large to add up.” and the engine logs a warning that names the page and the chart.

Each message names the repair.

  • x is a text column, a date or datetime with no bucket function, a multi, a list, a computed column or an aggregate column, or a bucket function is given a column that is not a date or datetime.
  • y is over a column that is not a stored int, decimal or money column. A computed column and an aggregate column are not charted.
  • weight: names a decimal column. A weight is a whole number, so name an int column.
  • y is avg. The message shows sum and count with ratio and round.
  • by is not an enum or a bool, has more than 4 values, or is the same column as x.
  • stack: true has no by:, is on min or max, or is on a line.
  • kind: line has no time x. A line between two values with no order claims an order.
  • last is above 60, below 1, missing with a time x, or written with an x that is not a time.
  • top is above 12 or below 1, or is written with an x that is not a ref.
  • weight: is on anything but sum, or names a column that is not an int.
  • empty: is missing on sum, min or max, or a block is written on a count.
  • A sensitive column is in x, y, by, weight: or where:. A chart is an aggregate that no grant is consulted for, so it would show an ungranted reader what the column holds. Show the column in a report with grants: instead. See Sensitive columns are granted per role.
  • A where: names a gone state of the chart’s own table.
  • A page has a fifth chart. Each chart is one query on every view. Fold two charts into one with by:, or move one to another page.

A chart takes only the properties in the table above.

// Refused: avg is not part of the language.
chart of line_items "Average price" {
x: kind
y: avg(unit_price)
}

For a walk-through, read Show a chart on a dashboard. For the query time, read Project status.

A crosstab whose columns are generated from the data. The rows come from one table, the columns from another, and each cell is a row of a junction table.

matrix of grades "Grades" {
rows of enrolments {
where: course = :course.id
label: student
}
columns of assessments {
where: course = :course.id
label: name
}
cell: points
key: enrolment, assessment
empty: "—"
}

key: names two ref columns of the cell table, one for each axis. The compiler checks exactly that.

cell: names a column of the cell table. It can also read one stored column of the row that a one column finds: cell: report_grade.points. A role then needs the grant of that column, here grants: report_grades.points. For a role without it, the matrix does not appear.

The compiler refuses a cell: path through a ref, such as student.name. Declare a computed column on the cell table with value: student.name and name it instead.

An axis’s where: that reads a sensitive column needs a grant for every role that can read the matrix, as a region’s own where: does. Which rows head the grid tells a reader something about the value. The compiler refuses the matrix and names the column.

label: names the column that heads each row or column of an axis. Without label:, the heading is the display of the axis table. For a table of students with display: last_name, first_name, a row reads Miller, Anna.

Both table-sourced axes require where:. A matrix has no pager, so each condition selects the rows that belong on the matrix. Use a condition that reflects that selection; a flag added only to satisfy the compiler does not keep a growing axis small. An axis over a relation of the page’s record, such as rows of :course.enrolments, needs no where:: the record selects its rows.

An axis leaves out the rows of its table that are in a gone state. To show them, write gone: show in the axis, beside its where:. See state.

A matrix is read-only today. Writing a cell needs upsert-on-key, because a cell addresses a row that can be absent.

NOTE: Both axes cannot read the same table. The two keys do not say which axis they address, and source order is not allowed to decide it. The compiler refuses that shape and names the reason.

The history of the page’s record: every version of its versioned columns, newest first.

page post "Post" {
route: /posts/{id}
access: editor, author
data post of posts
form of posts { fields: title, body }
versions of posts "History" { access: editor }
}

A versions region takes access: and nothing else. Its record is the page’s, and its columns are the table’s versioned columns. The compiler refuses it when the table keeps no versions, and when the page’s route does not bind a record of the table.

Each version shows:

Column Shows
Saved the time of the save, in the page’s time zone
By the person’s profile name, the roles when there is no profile (several are joined with commas), “A former user” when the login was deleted, and “A visitor without a sign-in” for a save without one. Never an e-mail address
Changed the versioned columns that differ from the version before
Status then the record’s lifecycle state after the save, on a table with a lifecycle

Compare shows the change from the version before at ?mtd_compare=<a>,<b>, as an ordinary page. Text, long text, Markdown, and e-mail columns are compared line by line. A Markdown column compares its source text. Each line is marked with <ins> or <del>, a + or − sign, and the word “Added” or “Removed” for a screen reader, so the colour is never the only signal. Other columns show the value before and after. When two texts are too different to compare within the limits (20,000 lines on a side, or 600 changed lines), the two texts stand side by side instead.

Restore opens the page’s own form at ?mtd_restore=<version>. The versioned fields hold the version’s values, and every other field holds the current value. Nothing changes until the person presses Save, and the save is an ordinary save: every rule, deny when, and hook runs, a ref must name a record the person may choose, and a Markdown image must be a picture they may open. The save adds a new version; it never rewrites an old one.

If somebody saved the record after the restore form was opened, the first Save is refused with a message, and the form comes back with what was typed. Pressing Save again restores anyway.

Seeing and restoring are two permissions.

  • Seeing needs the region’s access: and the page’s record. A region without its own access: follows the page’s rule, except that a visitor without a sign-in never sees it. Write access: public to show a history to everybody.
  • Restoring also needs a form on the page that edits this record for this person and has a versioned field that is not readonly:. Without one, the Restore link is not drawn and the address answers 404.

A version of another record, like a version that does not exist, answers 404. So does a malformed address.

Two text columns of the page’s record, shown as a line diff: what changes when the first column’s text replaces the second’s. The newspaper uses it to show what publishing a pending revision would change.

page newsroom_post "{:post.title}" {
route: /newsroom/posts/{id}
access: admin, editor
data post of posts
form of posts { fields: title, body, pending_title, pending_body }
compare pending_title with title "Title changes"
compare pending_body with body "Changes to the text" {
access: editor
empty: "No revision is waiting."
}
}

compare <column> with <column> "Label" names two columns and no table. Both are columns of the page’s record. The label is optional; without one, the heading is the first column’s label. The block takes access: (or an access { } block) and empty:, and nothing else.

The region shows one of three things:

When Shows
the first column is empty the empty: text, or “Nothing pending.”
the two texts are the same “No changes: both texts are the same.”
otherwise the lines of the second column that the first removes, and the lines it adds

The diff is the one a versions comparison draws. Each line is marked with <ins> or <del>, a + or − sign, and the word “Added” or “Removed” for a screen reader. A markdown column compares its source text. Above 20,000 lines on a side, or 600 changed lines, the two texts stand side by side instead, each under its column’s label.

The compiler refuses the region:

  • on a page whose route does not bind one record;
  • for a column that is not text, long text or markdown, and for a computed column;
  • for a markdown column beside a column that is not markdown. A text and a long text column can be compared;
  • for the same column twice.

The region reads the page’s record, under the page’s rule and its own access:. A region without its own access: follows the page’s rule, except that a visitor without a sign-in never sees it, because the first column usually holds text that is not published yet. On the page’s new_route: the region is left out, because there is no record.

A column may be sensitive. Then a role sees the region only when its own rule grants both columns. For every other role, and for a visitor without a sign-in, the region is absent: a diff of one column would show the other column’s text. Each view by a granted role is recorded as a sensitive.read in the audit log, one event per column.

compare pending_note with note "Desk note changes" {
access {
editor { grants: posts.note, posts.pending_note }
author
}
}

Here the author may open the page but does not see the region.

A note is a box of text on the page: guidance, a warning, or the one step a reader should take next. It has no table of its own.

note "Events on your device" {
text: "Choose your alliances and subscribe from your calendar app."
button "Create my calendar" -> subscribe
}
Property Takes Effect
text a sentence in quotation marks the body. Required
style info or warning warning adds an icon and the word “Warning”. Default info
when a condition over page values the note is left out of the page when it is false
access role names only these roles see the note
button "Text" -> page a page name one primary button under the text. See button
link "Label" -> "<address>" a label and an address in quotation marks up to three links under the text. See link

The label is the note’s heading, and it is optional. The label and text: can show page values, for example "{:days_left} days left".

when: shows the note only while its condition is true. Read a page’s data column with its binding, such as :mark.area. An enum column accepts its member names in comparisons: :mark.area = oral and :mark.area in (oral, project). Bare column names are unavailable in a note.

A condition that reads a sensitive column needs a grant for every role that can read the note, as a text that shows the value does. Whether the note appears tells the reader something about the value. The same rule applies to a form’s deny when, because its message is shown in place of the form.

button "Text" -> page draws a primary button under the note’s text. It follows the rules of a region’s button:

  • It passes no record. The target page opens at its new_route:, or at its route: when the route has no parameter. A target reachable only with a record is a compile error.
  • A reader who may not open the target page does not see the button. The note is still shown.
  • When the note is left out by when: or access:, its button is left out too.

A note has at most one button. A second button is a compile error. Put further actions in a region’s toolbar. The button of a note takes an icon in the same way as a region’s, as in button "Members" icon users -> members.

link "Label" -> "<address>" draws a link under the note’s text. Use it when the next step is a page whose address contains a value of the page. A note on a post’s edit page can link to the post’s preview:

note "Preview link" {
text: "Readable before publication. Pass the link only to people who may see the post."
link "Open the preview" -> "/preview/{:post.preview_token}"
}

Write the address in quotation marks. The label and the address can contain page values. The rules for the address:

  • It begins with / and is a route: or new_route: of the same application. The compiler finds the page it opens. A link to another website is not available in a note. An address with a scheme such as https: or javascript:, an address that begins with //, an address with a ? or a #, and an address that matches no route are compile errors.
  • A page value fills a whole segment between two slashes. "/preview/{:post.preview_token}" is correct. "/preview-{:post.preview_token}" is a compile error. A page value can fill only a {parameter} segment of a route, never a fixed word.
  • A page value in an address is a text, email, slug, unguessable, enum or int column, the way the database stores it. A ref, a date, a money and a decimal column are compile errors, because the page shows them in another form.
  • The engine writes each value as one segment of the address. A slash, a ?, a # or a quotation mark in the value stays inside the segment. A value that is empty, . or .. gives no link.
  • A reader who may not open the target page does not see the link. The note is still shown.
  • When the note is left out by when: or access:, its links are left out too. A sensitive column in the label or in the address needs a grant for every role that can read the note, as for text:.

A note has at most three links. A fourth link is a compile error. Use a nav or a region’s toolbar for more places. The links are drawn above the note’s button, if it has one. A translation can change the label of a link (page.<page>.note.link.<n>). The address is not translated.

One row, with a control per field. A form is the region for creating and editing.

Property Meaning
fields which columns, in which order. Without it, every stored column except a slug, an unguessable, a derived column, the lifecycle state, the audit columns and a column that a set fills. The compiler warns about a form without fields:
actions any of save, delete, duplicate. Without it, save and delete. An action block can limit who uses delete and duplicate
readonly fields shown as values rather than controls
success the message after a save
after_save where a save sends the browser: back, row, or a page name. The default is back

A save is a POST, then a redirect, then a GET. The message survives the redirect, so a reload never repeats a write.

The engine arranges the fields. You write no layout syntax. The fields: order is the order of the controls, the Tab key and a screen reader.

When the form is at least 30rem (480 px) wide, it has two columns. Below that width it has one column. The width of the form decides, not the width of the window. A form in a dialog is about 31rem wide and has two columns. A form in half of a row { } is narrower and has one. A phone shows one column.

A short field takes one cell of the two. Any other field takes both. The column type decides:

Column type Width
date, datetime, int, money, decimal, bool, enum short
text, email, long text, markdown, ref, multi, img, file full

A short field is full width in three cases: it is in readonly: (it is then a value, not a control), it has add_via:, or its help text is longer than 80 characters.

Short fields that follow each other in fields: share a row. A field never moves to fill a gap. A short field whose next field is full width stands alone at the start of its row, at half width. To pair two short fields, write them next to each other in fields:.

For example, with fields: title, starts_at, ends_at, description, places, signup_deadline, the title and the description take a full row each. starts_at and ends_at share a row, and so do places and signup_deadline. At 1280 px, a 13-field event form is 947 px tall instead of 1236 px. At 360 px the form is one column and 1277 px tall.

What a form shows when it has no field list

Section titled “What a form shows when it has no field list”

When a form has no fields: line, it shows the columns in the list above. A column that you add to the table later then appears on the form, and a request can write it, although you did not change the page. A column that needs a grant still needs the grant.

The compiler warns once for each form that has no fields: line. The message gives the line to write. The line lists the columns the form shows today, in the order of the table:

pages/member.mtd:7:3: warning: form of members has no fields:, so it shows every writable column of members and a column added later appears on the form
write `fields: name, fee, notes` in the form to keep today's controls; a column added to members later then stays off the form until you list it

Write the line in the form. The form then shows the same controls as before. A column that you add later stays off the form until you add it to the line. The warning does not stop an install, and matterdata validate -strict still passes. A form whose table has no column to list does not warn.

A form that creates a row must supply its required columns

Section titled “A form that creates a row must supply its required columns”

A form that creates a row can save only if the row has a value for every required column that has no default:. The compiler refuses a form that cannot supply one. The message names the page, the form and the columns:

pages/notes.mtd:7:11: the form of notes on page "note" creates a row but never supplies `owner`, `topic`, which are `required` with no `default:` — every save through it would be refused, so the form could never save (decision 0010)
list owner, topic in this form's `fields:`, or give the column a `default:` in the table, or add `set owner = <expression>` to the form

A column counts as supplied when the form lists it in fields: (or shows it by default), fills it with set, or the column has a default:. The engine also fills a slug, an unguessable, the lifecycle state, the audit columns and the app scope column. The check skips a table with a before insert or before save hook, because the hook can fill the column and the compiler cannot read it. A form that edits a row of its own table is not checked: the stored row has the values.

By default a save goes back to the page the form was opened from. A row link, a row action and a button add that page’s address to the link. The address keeps its search, filters, sort and page number, so a save from page 2 of a filtered list returns to page 2 of that list. The message appears there. When the form’s page also shows a list, you can sort, filter or page that list first: the save still returns to the page the form was opened from.

Value After an insert After an update After a delete
back the page the form was opened from the page the form was opened from the page the form was opened from
row the new row’s page the form’s page the page the form was opened from
a page name that page that page that page

When the form was not opened from a page of the same app, back uses these targets: the new row’s page after an insert, the form’s page after an update, and the app’s home page after a delete. A delete never returns to a page about the row it removed.

form of members {
fields: first_name, last_name
after_save: members
}

row needs a page whose route is about a row of the form’s table. A page name must be a page of the same app, and every parameter of its route must be known after the save. A parameter is known when both routes of the form’s page carry it, or when the target’s route is about a row of the form’s table: then the saved row fills it. The compiler names a parameter that is not known. If the address needs the deleted row, a delete uses back.

A page whose route uses an unguessable column keeps its row’s page after an insert and an update. That address is the only way back to the row.

A field whose storage the engine owns is never a control. A control that the write path will refuse can only lose somebody’s work.

set <column> = <expression> [when <condition>] fills a column without a control. It applies on both create and edit. A submitted value cannot override it, even when fields: lists the column. A false or empty when condition keeps the column’s previous value or default.

All set values and conditions read the same candidate row: stored values, then defaults, then submitted fields. The engine applies their results together. Declaration order changes nothing. A set cannot read another set’s result:

set employee = :user.employee_id
set department = employee.department

The compiler warns when a set value reads another column set by the same form. This is valid when the previous value is intended, so the warning does not prevent installation. Self-reads and when conditions do not trigger this warning.

Here department reads the employee before these sets apply. On create, that employee can be empty; on edit, it is the stored employee. To copy the signed-in employee’s department, load the employee as a page data row and use :me.department. See Fill in a value the user never types. A form’s deny when reads the completed row after all sets apply.

A form open to visitors shows its ref and multi options

Section titled “A form open to visitors shows its ref and multi options”

A ref or multi control lists up to 200 rows of the referenced table by their display: text. It does not list a row in a gone state (state). A table has no read rule of its own, so on a form that a visitor with no login can open, anyone who opens the page sees that list. Only a region filter about the referenced table makes the list shorter. access: public on the page makes its option lists public too. Put a ref or multi on a public form only when every row of that table may be public. This applies to create forms and to edit forms on a token route.

A submitted value must be one of the rows the control can offer. The engine refuses any other value on the control, and writes nothing.

A ref shows no control, and no list, when a set fills it or when it is in readonly:. For a sign-up, fill the ref from the page’s row:

form of event_signups {
fields: guest_name, guest_email, note
set event = :event.id
}

actions: duplicate and the duplicate block

Section titled “actions: duplicate and the duplicate block”

duplicate adds a link that opens the page’s new_route: with the values of the row on screen. The action is opt-in: a form that writes no actions: gets save and delete.

form of events {
fields: title, starts_at, ends_at, place, capacity
actions: save, delete, duplicate
duplicate {
clear: starts_at, ends_at
label: "Copy as template"
}
}
Property Meaning Default
clear columns the copy leaves empty, in addition to the ones it never carries none
label the link’s text an engine word
access who can copy, as in an action block everybody the form admits

A copy fills in the controls the form has. It therefore carries no engine-owned column, no lifecycle state, no set column, no derived column, and no sensitive column the role may not read. It also leaves a readonly: field, a picture, and a column that is unique on its own empty. A column that is unique only in combination is carried.

clear: only removes. Naming a column the copy would not have carried is a compile error.

The link opens an ordinary page: a record the reader may not see answers 404, and the save that follows is an ordinary create. The compiler refuses duplicate on a page with no new_route:, on a route that carries scope, on a page about no record, and on a form that writes a different table from the one the page is about. See Duplicate a record.

A field block overrides one column’s presentation for this form. It accepts add_via, empty_label, help, label, min, max, quick_picks, rows, show_when and suggest.

form of events {
fields: title, alliance
field alliance { empty_label: "All alliances" }
}

A default: and a value: are refused there. Both are data, so both stay on the column. A min: or max: is refused for a column that does not accept one, as it is on the column. See Column types for each property.

Declare each column in one field block. A form resolves a field by its first block, so a second block for the same column never reaches the page. The compiler refuses the second block and names the line of the first. Put every property for one column together:

field ends_at {
suggest: starts_at + 1h
help: "Enter the date and time in UTC."
}

show_when: takes a condition over the form’s own fields. While the condition is false, the browser hides the field.

form of events {
fields: title, repeat, every, until
field every { show_when: repeat != none }
field until { show_when: repeat != none }
}

The condition uses the same expressions as where: and check. The engine sends it to the browser as data, and one engine-owned script reads it. An application supplies no JavaScript.

The hidden field keeps its control, its name and its value. A save therefore sends the same values whether the reader has JavaScript or not. The server does not read the condition: every check, require ... when, set, deny when and hook sees the same request.

A reader with JavaScript turned off sees all fields. Nothing is hidden, and the form still saves.

A hidden field is not required in the browser. require <column> when <condition> marks the field as required when the saved row meets the condition. If the reader turns the condition off, the browser hides the field and removes the requirement, so an empty hidden field does not stop the save. When the browser shows the field again, the field is required again. The server still applies the require rule to each save. If the rule refuses the save, the page shows the field with its error, and show_when: does not hide a field that has an error.

show_when: accepts a smaller set of conditions than where:, because the browser must give the same answer as the database.

You can write You cannot write
a field of this form, or a fixed value of that field’s type a path such as alliance.name, :route/:user/:app, today, now, a function, a count, a computed column
a source column of type enum, bool or int text and long text (the engine compares text by Unicode rules itself, and a browser compares bytes), date, datetime and money (the control holds a spelling and the server holds the value)
a ref with is empty or is not empty ref = <value>, because the value would be a row id
=, !=, is empty, is not empty, and, or, not <, <=, >, >=

Each refusal names the repair. Three more conditions are refused:

  • A required column cannot be hidden. The browser refuses to save a hidden empty required control, and the reader sees no message. Make the column optional and write require <column> when <condition> on the table. The same condition then runs on the server.
  • A field cannot name itself. A control that hides itself cannot be shown again.
  • show_when: works in a form only. In a sheet or a report, one field is a column of many rows.

An empty value never makes a comparison true. repeat != none is false while repeat is empty, both on the server and in the browser. Write is empty to test for an empty value.

If a sensitive column is not shown to this role, the condition that reads it is not sent, and the field stays visible. See Control who sees what.

add_via: creates the row a ref field is missing

Section titled “add_via: creates the row a ref field is missing”

add_via: names the page that creates a row of the table a ref field points at. The engine draws a control beside the dropdown.

form of events {
fields: title, category
field category { add_via: admin_category }
}

The reader opens it, fills in the new category, and saves. The category becomes the selected option, and everything they had already typed in the event form is still there.

The named page decides everything about that save: who may make one, which fields they see, what a refusal says. add_via: adds none of it. So a reader who may not open the create page sees no control at all — not a disabled one, and no message. The field itself is unchanged.

In a browser the page is fetched without its frame and opened as a dialog. With JavaScript turned off the control is a link to that page, the reader creates the row there, and the save returns to the form they left, unless the create page sets after_save:. That is the same walk they take without the declaration, so nothing depends on the script.

Each of these is a compile error, and each names the repair:

  • the field is not a ref — a multi has no single option for a new row to become;
  • the page does not exist;
  • the page has no new_route:, so there is no address a row is created at;
  • the new_route: carries a route parameter, and the form that opens it has no value for it;
  • the page’s form writes a different table from the one the ref points at;
  • the page has no form at all;
  • the page is the page that declares add_via:;
  • add_via: is written outside a form.

suggest: offers a value for an empty field

Section titled “suggest: offers a value for an empty field”

suggest: fills an empty datetime field from another datetime field of the same form.

form of events {
fields: title, starts_at, ends_at
field ends_at { suggest: starts_at + 1h }
}

Write one field of this form, a +, and one duration. A duration is a whole number with one unit: min, h or d. Write 30min, 1h or 7d. There is no compound spelling, so write 90min and not 1h30min. The shortest duration is 1min and the longest is 7d.

The engine sends the field name and the number of minutes to the browser as data. One engine-owned script reads them. An application supplies no JavaScript.

Three rules decide when the browser writes a value:

  • On a new row only. The engine sends the hint on the page that creates a row. It never sends it on a page that edits one. An empty end time on a stored row is an answer somebody already gave.
  • Into an empty field, or into the value the script wrote last. A value somebody typed stays. If the reader clears the field, the field is empty again, and the next change to the source fills it again.
  • On the spelling, not on an instant. The script adds minutes to the wall clock in the control. It does not know the page’s time zone. The server still decides which instant that wall clock names. See Set the time zone.

A reader with JavaScript turned off sees an empty field and fills it in. The form saves the same values either way.

Each of these is a compile error, and each names the repair:

  • The field it fills, or the field it reads, is not a datetime. A date has no hours, and suggest: over a date is not built.
  • The field suggests from itself.
  • The form lists the source under readonly:, fills it with a set, or leaves it out of fields:.
  • The duration is 0min, is subtracted, or is longer than 7d.
  • The suggest: is in a sheet or a report. A value written into the same column of forty rows is a bulk edit and not an offer.

If a sensitive source column is not shown to this role, the engine sends no hint, and the field is an ordinary empty control.

quick_picks: puts a value into a field with one press

Section titled “quick_picks: puts a value into a field with one press”

quick_picks: shows small buttons under a field. When the reader presses one, the browser writes its value into the field. The reader can still change the value, and the form’s Save button saves it.

form of events {
fields: title, starts_at, location, minutes
field starts_at { quick_picks: now }
field location { quick_picks: "Kingdom", "Castle" "The castle" }
field minutes { quick_picks: 15, 30 "Half an hour" }
}

Write a value, and then the text of the button if you want one. Separate the picks with commas. If you do not write a text, the engine names the button: now shows “Now”, today shows “Today”, an enum member shows its label, and any other value shows itself.

The field’s type decides which values you can write:

Field Value
datetime now
date today
enum the name of a member
int a whole number
text, long text, email quoted text

now and today read the clock when the reader presses the button, not when the page loaded. They use the time zone of the page, not the time zone of the reader’s device. On a page in UTC, now writes the current UTC time. See Set the time zone. On an enum, now and today are member names.

The buttons appear on the page that creates a row and on the page that edits one. They need JavaScript. A reader with JavaScript turned off sees no buttons and types the value. The form saves the same values either way, and the server checks a picked value like a typed one.

Each of these is a compile error, and each names the repair:

  • The field is a bool, a ref, a multi, money, or another type not in the table.
  • A value does not fit the field’s type, for example today on a datetime.
  • An enum pick names a member that the enum does not have.
  • The same value appears twice.
  • A value is a duration, a :user… or :route… parameter, or a path.
  • A button text is empty.
  • The form does not show the field, or lists it under readonly:.
  • The quick_picks: is in a sheet or a report.

An int pick outside the field’s min: or max: compiles. The save refuses it with the same message as a typed value.

A table that a person edits like a spreadsheet, with one save for every change. Use a sheet when writing one row at a time is the wrong shape, such as entering a mark for every student in a class.

sheet of members "Maintain members" {
columns: name, email, fee_group, active
where: left_on is empty
sort: name
page_size: 50
actions: save, add, delete
row -> member
}
Property Meaning
columns which columns, in which order. Required.
page_size rows per page of the list that a reader without JavaScript gets. Default 25, as in a report.
row -> <page> the page whose form edits one row. Required.
actions any of save, add, and delete. Default save. An action block can limit who uses add and delete

search, filter, sort, where, gone, and empty are a report’s and mean the same thing. A sheet’s rows are the listing’s rows, from the same query. A save can change or remove only those rows. A row in a gone state is not in the list unless the sheet says gone: show, so a save that names such a row is refused and writes nothing. export: and limit: are refused in a sheet, each with the line to write instead.

A read region can default its columns. A write region cannot: defaulting columns: makes every column of the table editable, including columns that the author never named.

A sheet without page_size: shows 25 rows per page to a reader without JavaScript, the same number as a report without limit:. Write page_size: to change the number. It does not change the grid, which loads 200 rows at a time. A sheet without page_size: beside a list with page_size: is a compile error, because a page has one page number. Write limit: on the list instead.

row -> must name a page that holds a form of the sheet’s own table, on a route that carries the row. The compiler refuses a target that only shows the row, and a form that creates a new row. The target is never derived.

A sheet has two renderings, and you declare neither.

  • With JavaScript, the sheet is an editing grid. The grid loads the rows 200 at a time while the reader scrolls, so it holds every row of the list and draws no pager.
  • Without JavaScript, the sheet is exactly a report: the table, the search box, the filters, the sort links, and a pager of page_size: rows. No cell is editable. The identity cell of each row links to the row -> page, where its form edits that one row.
  • On a coarse pointer below 40rem, such as a phone, the grid does not mount, and the reader gets the report layout with its row links. The engine asks both questions once, when the page loads.

A column’s help: is shown in the grid. The column’s header has a help button with a question-mark icon. Press it to open the text below the header, and press it again, press Escape, or press anywhere else to close it. A screen reader reads the text as the button’s description, so the reader does not have to open it. The list without JavaScript does not show help:.

A row link is drawn only when the reader can open the target page with that row, as in a report. A row that the target page would not show stays in the list without a link. So a sheet that shows an author every note of a folder links only her own notes, if the note page shows an author only her own.

The page accepts a save only as the grid’s JSON request. A form-encoded save of a sheet is refused before anything in it is read.

One list of columns decides which cells are editable. A cell is read-only when the engine owns the column, when the column is derived, or when a role’s rule does not grant it. A save that names a read-only column does not write it.

One save is one transaction. If any cell is wrong, nothing is written, and the grid shows each message on its cell and keeps every edit. The grid sends only the rows that somebody changed. The engine compares each sent row with storage and writes only the rows that really changed.

Each row carries a stamp. If a row changed after the grid loaded it, the save is refused and names the rows that moved. A sheet is the screen two people open at once, so a silent overwrite is the wrong default.

One save carries at most 200 rows. If a before hook runs on each row, one save carries 50 rows. The count is the changed rows, the removed rows, and the new rows together. A before delete hook counts only when actions: includes delete, and a before insert hook only when it includes add. A save over the limit is refused before anything is written, and the grid says so before it sends the save. page_size: is independent of this limit.

actions: delete lets the reader mark rows for removal: the Delete rows button, or the same entry in the right-click menu. The save removes the marked rows first, in the same transaction as the cell changes. A marked row is not checked against any rule of its table. The row stamp still applies: a marked row whose values changed is refused rather than removed. A removal that another table’s reference blocks is refused with a message that names the row. The slug of a removed row stays reserved.

actions: add lets the reader add rows: the Add row button, Insert row in the right-click menu, or a paste past the last row. One save can create any number of new rows. The engine creates them last, in the order they were sent, in the same transaction as the cell changes and the removals. If one new row is refused, none of them is created.

A new row starts with each column’s default:, the default lifecycle state, and the application’s scope column. A set on the region fills its column too. A read-only cell stays empty until the save.

A new row whose cells all still hold their defaults is not a request. The grid does not send it, and the engine drops it when it arrives. A new row with one cell filled in is a row somebody started. Every rule of the table applies to it, and each message comes back on its cell. A message about the row as a whole names it, for example “New row 3”. Two new rows with the same unique value are refused on the later row.

An empty sheet shows its empty: text above the grid, and the engine’s own sentence for a filter that matched nothing. A sheet with add still offers the grid, so that somebody can create the first row.

A sheet with add must be able to fill every required column of its table. Four things satisfy that: the column is writable in columns:, it has a default:, the region has a set for it, or the engine owns it. A sheet that leaves one required column unsatisfiable is refused when the tenant is opened. The message names the column and all four repairs.

A sheet whose where: reads a route parameter cannot use add, and the engine refuses it when the tenant is opened. The new row has no cell for the column that the condition is about, so every added row would be refused. Create the row in a form on its own page instead.

The message after a save appears above the grid. It is built from up to three counts, in one order: rows changed, rows added, rows deleted. A count of zero is left out. A save that did none of the three says so.

You declare nothing for the grid. No property turns it on, and no property turns it off.

The grid has two modes. In navigate mode the arrow keys move between cells. Typing, F2, or a double click starts an edit in the active cell, and the arrow keys then belong to the text. Typing replaces the value. F2 and a double click keep it. Escape discards the edit. Enter and Tab commit the edit and move.

Key Effect in navigate mode
Arrow keys move one cell
Shift + arrow keys extend the selected range
Ctrl + arrow keys jump to the last filled cell before an empty one, or to the edge
Home, End the first and the last cell of the row
Ctrl + Home, Ctrl + End the first and the last cell of the grid
PageUp, PageDown one screen of rows up and down
Tab, Shift + Tab the next and the previous cell. Tab wraps to the next row and stops at the last cell.
Enter, Shift + Enter one row down and up
F2 edit the cell and keep its value
Space tick or clear a checkbox cell. In another cell, start an edit with a space.
Ctrl + A select every cell
Ctrl + C, Ctrl + X, Ctrl + V copy, cut, and paste the range
Delete, Backspace clear the selected cells
Ctrl + Z undo the last step
Ctrl + Y, Ctrl + Shift + Z redo it

On a Mac, use Command where the table says Ctrl.

The row-number column at the left selects whole rows. Click a number to select its row, or drag down the numbers to select several rows. The corner above the numbers selects every cell. A right click opens a menu with Insert row, Delete rows, Clear contents, Undo, and Redo.

Copy and paste work with Excel. A copy writes tab-separated text with Excel’s quoting, so a cell that holds a tab or a line break survives the round trip. A paste reads the same format. A paste never writes a read-only cell, and columns past the last column are not pasted. Rows past the last row are added when the sheet offers add, and are not pasted when it does not. The line under the grid reports how many cells were pasted and how many rows were added.

A dropdown cell copies its label, not the stored value behind it. A paste matches the text to an option’s label exactly, including upper and lower case, and then to its stored value. If neither matches, the cell keeps the value it had. The line under the grid names that cell, for example Status has no option called Nope. When more than one cell does not match, it gives the number, for example 3 cells matched no option and kept their value. In a multi-select cell, one part that does not match keeps the whole cell. An empty pasted cell clears a dropdown. A ref dropdown offers at most 200 rows of the target table, so a label past that limit cannot be matched.

A fill continues a series. Select the source cells, then drag the small square at the corner of the selection. A whole number, an amount, and an ISO date continue a constant step. One date steps one day. Task 1 becomes Task 2, and any zero padding is kept. A datetime, a checkbox, a dropdown, and text without a trailing number repeat instead. A datetime does not step, because a step across a clock change is the page time zone’s question. A fill to the side into a different dropdown column carries the label that is shown, and matches it like a paste: a label with no option keeps the cell’s value, and the line under the grid reports it.

Ctrl+Z undoes one step: an edit, a paste, a fill, a clear, an added row, or a removal mark. The grid keeps up to 200 steps. Ctrl+Y puts a step back.

Sorting and filtering reload the grid. A header click follows the list’s own sort link, so the server sorts every row and not only the loaded ones. The filter form reloads the list too. If the grid holds unsaved edits, it asks before it follows either one, and before the reader leaves the page.

A row that another person moves into a part of the list that the grid already loaded appears after the next reload.

Status: actions: save, actions: add, and actions: delete all work. An img column in columns: is accepted by the compiler and refused when the tenant is opened, because there is no editor for it yet. Edit a picture in a form on the row’s own page. The grid is tested in Chromium and WebKit against the real engine on every change. It has not been tested with a screen reader. See Project status for what that means and what can still change.

actions: says which actions a region has. An action block says who can use one of them. A form can have a delete block, and a sheet can have a delete block and an add block. A form’s duplicate block takes the same access line.

form of posts {
fields: title, body
access: admin, editor
actions: save, delete
delete { access: admin }
}

Every editor can save this form. Only an admin can delete the post.

The block takes one access rule, as a property or as a block, and nothing else. It can name roles and rights, and a role can have a where filter:

sheet of posts {
columns: title, published
actions: save, add, delete
delete {
access {
admin
editor where not published
}
}
add { access: admin, editor }
row -> post
}
Rule Effect
Only narrows the page’s rule, the region’s rule and the block must all admit the person. The compiler refuses a block that names a role the page or the region does not admit
Absent for others a person the block does not admit gets no delete button, no copy link, and no Add row or Delete rows in the grid
A where filter applies to the row the action acts on. An editor above gets the delete button on an unpublished post and not on a published one
A request for an action the block withholds a delete from a person the block does not admit, or for a row its filter does not admit, is answered 403 and nothing is deleted. If the person cannot see the row at all, the answer is 404, as for a row that does not exist. A wrong CSRF token is still 400. A copy address gets the same 404 as a row that does not exist. A sheet save that carries a removal or a new row this person cannot make is answered 403, and nothing in it is written
A request for an action the form does not have a delete on a form whose actions: does not list delete, an unknown action name, and a delete on a page that has no row are answered 400
A sheet’s where filter the grid offers Delete rows on every row. The save is refused, and nothing is written, if a marked row does not pass the filter
add takes no where filter: a new row has no stored row to check. Use the sheet’s where: for a condition on new rows

The compiler also refuses:

  • a block for an action that actions: does not list (a form without actions: has save and delete);
  • save { … }, because the region’s own access decides who can save;
  • add in a form, because a form creates a row on its page’s new_route:;
  • grants: in the block, because the region’s rule decides what a role can read.

Website privacy policy