The page block
The page block declares one screen of the application: its address, who can open it, the
record it is about, and the regions it shows. A page holds no data of its own. Every value on
it comes from a table.
page event "Event" { route: /events/{id} new_route: new access: board timezone: user
data event of events var days_left = days_until(:event.signup_deadline)
note "Sign-up deadline" { style: warning when: :days_left <= 7 text: "Only {:days_left} days are left to sign up for {:event.title}." }
form of events { fields: title, starts_at, signup_deadline, published }
list of registrations "Registrations" { where: event = :event.id columns: name }}The example needs a role board, a table events with the four columns of the form, and a
table registrations with a ref(events) column event and a column name. Each line in it
has a section below.
page <name> "<Title>" { <properties, statements and regions>}By convention, each page is in its own file in the pages/ directory of the application, for
example pages/event.mtd. The compiler does not require this: it accepts several pages in one
file. The example applications in dsl/examples keep to one page per file, and a test checks it, so
copy that layout.
The name is an identifier in snake_case, such as event or fee_groups. It cannot contain
a dot. Other declarations name the page by it: a menu entry, a row link, a button, an
after_save: and an add_via:. When the page has no route:, the name also gives its address.
See route.
The title is optional. The engine shows it as the heading of the page and in the title of the browser tab. A listing with no label uses it as the caption of its table. With no title, the engine shows the page’s name.
The properties, statements and regions can be in any order. A property can be written once per
block. Notes and regions render in the order that you write them. data and var render
nothing.
The compiler refuses these pages:
| Refused | Reason |
|---|---|
a page with no access |
the page would render for nobody. See access. |
| a name that another page of the application already has | the message names the line of the first declaration |
a second access { … } block |
one block holds the rule of every role |
| a second paginated region | an address has room for one page number. See A page number is a query parameter. |
a second report, or a second sheet |
search, sort and filters are request parameters, and an address has one set of them |
grid |
the region was renamed. Write report of <table>, or sheet of <table> for an editable table. |
calendar |
the word is reserved for a region that is not built. See Project status. |
Page values in text
Section titled “Page values in text”A title can show a value of the page, written between braces:
page public_event "Sign up: {:event.title}" { route: /calendar/{slug} access: public
data event of events where published
form of registrations { fields: name set event = :event.id }}The same braces work in a region’s label, a note’s heading and text:, the label and the address of a
note’s link, empty:, submit:,
success: and the message of a deny when. Between the braces is one page value:
| Value | Is |
|---|---|
{:<data row>.<column>} |
a column of the page’s data row, such as {:event.title}. A ref column shows the display of the row it refers to: {:enrolment.student} is Miller, Anna. A path through the ref, such as {:enrolment.student.name}, is refused: see A page value is one stored column |
{:<var>} |
a page var, such as {:days_left} |
{:user.id}, {:user.<profile>_id} |
the id of the login, or of its profile row |
{:route.<parameter>} |
a parameter of the page’s address, as it was written in the URL |
The engine escapes every value for HTML. It writes a value in the notation of the application’s
locale: a date is 2025-12-31 in English and 31.12.2025 in German. An empty value is an
empty string. Write {{ and }} for a literal brace.
The compiler refuses a value that does not resolve, and it names the nearest correct spelling. It
refuses {event.title} without the colon, and names {:event.title}. The engine refuses a multi or
a list, which is a set of rows and not one value.
A value from a sensitive column can be in a text only when every role that can read the text
has a grant for the column. A text shows the same words to everybody who can read it, so the
engine cannot leave the value out for one role. The rule also applies to a var that reads a
sensitive column. On a page, every access rule must grant the column. In a note or a region
with its own access, every rule of that block must grant it, or the page’s rule for the same
role must. A public page can never show a sensitive value in a text. To show the value to some
roles only, put it in a region such as a detail. The region is absent for a role without the
grant.
route: /events/{slug}/sign-uproute: is the address of the page, inside the address of its application. A page at
route: /members/{id} in an application at mount: club is served at /club/members/17. See
App mount.
A route starts with /. Each segment is text, or one parameter in braces that fills the whole
segment. route: / is the start page of the application.
When there is no route:, the address is / and the page’s name, with each _ changed to -.
So page fee_groups is at /fee-groups.
The compiler refuses these routes:
| Refused | Reason |
|---|---|
a value that does not start with /, such as route: members or route: members/{id} |
a route is a path |
a parameter that is part of a segment, such as /fee-{slug} |
a parameter fills one segment of its own |
the same parameter name twice, such as /courses/{course}/parts/{course} |
nothing can say which segment the name means |
| more than 3 parameters | see Earlier parameters are scopes |
| a route that another page already declares | two pages cannot share an address. A new_route: counts. |
a first segment that the engine owns: matterdata, page, robots.txt, sitemap.xml |
see Reserved first path segments |
a first segment that is a language code, such as /de or /en/news |
a public page in another language is served at /de/<route>, so every language the engine can draw is reserved, whether or not the application lists it. See Language codes |
a first segment that the engine used to answer on, such as login or verwaltung |
the old address is a redirect now. The message names the new address. |
| a second route whose first segment is a parameter | two such routes answer the same addresses |
two routes that match a common address when neither route is a special case of the other, such as /events/{event}/signups and /events/form/{signup}, which both match /events/form/signups |
the engine cannot choose between them. The message names both pages and a shared address. Put the literal in the same position in both routes. A literal where the other route has a parameter is fine: /events/new and /events/{event} can both exist. A new_route: counts. |
Route parameters
Section titled “Route parameters”A parameter such as {id} or {slug} names one row, and the row is the page’s record. The
section How the route finds the row gives the rules.
Every parameter is also a value. :route.<name> reads it in a where:, a var, a note’s
when: and an access rule, and {:route.<name>} shows it in text:
page registrations_of "Registrations" { route: /events/{event}/registrations access: board
list of registrations { where: event = :route.event columns: name }}A one-parameter route can carry a parameter that is only read, like {event} above. The
compiler refuses a parameter that binds no row and that nothing reads. When a column of the
data row’s table has a similar name, the message names that column.
The compiler also refuses these parameters:
:route.<name>for a name that the route does not carry.- a parameter that names a
sensitivecolumn. An address is kept in the browser history and in server logs, where no grant is checked. Address the row by{id}, aslugor anunguessablecolumn.
A route whose first segment is a parameter, such as route: /{slug}, is matched after every
route that starts with text. So /{slug} cannot hide another page. A slug is never derived as
the first segment of another route of the application, or as a reserved segment.
Earlier parameters are scopes
Section titled “Earlier parameters are scopes”A route can carry at most 3 parameters. The last parameter is the page’s record. Each earlier parameter is a scope: it narrows which records the address can reach.
page assessment "Assessment" { route: /courses/{course}/grades/{ln} access: teacher
data ln of assessments
detail of assessments { row: :ln fields: caption, on_date }}The page is about an assessment. {course} names the course column of assessments, so
the engine reads the row with the condition course = :route.course. The address
/courses/5/grades/99 is a 404 when assessment 99 belongs to another course. It is the same
404 as an assessment that does not exist, so the address cannot be used to learn which rows
exist.
The rules for an earlier parameter:
- Its name is a
refcolumn of the page’s record, or a path of at most 3refcolumns from it. The compiler takes the shortest path.{course}on a page aboutmarksfindsmarks.assessment.course. - It is compared with the row’s
id. So/courses/{course}/…takes a number, not a slug. - The last parameter keeps its own naming rules. That is why the example can call it
{ln}.
The compiler refuses these routes:
| Refused | Reason |
|---|---|
an earlier parameter that no ref path reaches |
the engine has nothing to check the parameter against |
| an earlier parameter that two paths of the same length reach | they are two different questions, and the compiler does not choose one |
| a route with 2 or 3 parameters whose last parameter names no row | there is nothing to check the earlier parameters against |
A row link fills the earlier parameters
Section titled “A row link fills the earlier parameters”A row -> link or a row_action link can open a page with 2 or 3 parameters. The clicked row
fills the last parameter, as for any row link. It fills each earlier parameter by following the
same ref path that the target page checks:
page course "Course" { route: /courses/{course} access: teacher
data course of courses
list of enrolments { where: course = :course.id columns: student, status row -> enrolment }}
page enrolment "Enrolment" { route: /courses/{course}/enrolments/{enrolment} access: teacher
data enrolment of enrolments
detail of enrolments { row: :enrolment fields: student, status }}The row of enrolment 7 in course 3 links to /courses/3/enrolments/7. {course} is the row’s
course column. On a page about marks with /courses/{course}/grades/{assessment}/mark/{note},
{assessment} is the row’s assessment and {course} is assessment.course.
The link is only a convenience. The target page still checks every earlier parameter when it reads the row, so an address with a changed course number is a 404.
A row whose path ends at an empty ref gets no link, because the target page would answer 404.
The compiler refuses these links:
| Refused | Reason |
|---|---|
| a link from a region over another table than the target page’s record | the path starts at the target’s record, so a row of another table has nothing to follow |
a link whose path goes through a sensitive ref column |
the value would be in the address, where no grant is checked |
A page number is a query parameter
Section titled “A page number is a query parameter”A page with a paginated region shows page 2 at ?page=2 on its own address, for example
/members?page=2. A route never contains the page number. A report is paginated at 25 rows
unless it has a page_size: or a limit:, and a sheet without page_size: is paginated at
25 rows too. See
A report shows 25 rows per page.
A page number that is not a positive whole number, or that is past the last page, is a 404. An
old address that ends in /page/<n> redirects to ?page=<n>.
new_route
Section titled “new_route”route: /events/{id}new_route: newnew_route: is a second address of the same page, without a record. Its form creates a new row
there. Without new_route:, a form on a page whose route binds a row can only edit that row.
Write the address in one of two ways:
- One word. The word replaces the last segment of
route:, and that segment must be a parameter. Earlier segments stay as they are. - A full path that starts with
/. Use it when the create address is not the route with its last parameter replaced, or when the segment has a hyphen.
route: |
new_route: |
Create address |
|---|---|---|
/events/{id} |
new |
/events/new |
/courses/{course}/assessments/{assessment} |
new |
/courses/{course}/assessments/new |
/events/{id} |
/events/create |
/events/create |
The word has letters, digits and underscores only, such as new, neu or add_member. The
compiler changes the word into the full path before it checks anything, so every rule for a
route applies to the result. When a rule refuses the result, the message shows the full path, for
example route /members/new is declared twice: … (new_route: new resolves to /members/new).
The create address has the page’s access: rule, because it is the same page. On this address,
the engine leaves out every item that needs the record:
- a note, a region or a
varthat reads the page’sdatarow. - every item that reads such a
var. - a
versionsregion and acompareregion.
A form and an item that reads nothing of the record render as they do on the page’s route:.
After the save, the browser goes back to the page that the form was opened from. A form’s
after_save: changes that. See after_save:.
A button passes no row. So a button to a page whose route: has a parameter opens that page at
its new_route:, and an add_via: always does. The compiler refuses the button or the
add_via: when the target has no new_route:, and when the new_route: carries a parameter. A
button has no row and no value to fill a parameter with.
A create address under a scope
Section titled “A create address under a scope”A new_route: can keep the earlier parameters of route:. Each one is a scope on the create
address too:
page assessment "Assessment" { route: /courses/{course}/grades/{ln} new_route: new access: teacher
data ln of assessments
form of assessments { fields: caption, on_date set course = :route.course }}The create address is /courses/{course}/grades/new. Before the form shows, and again when it
is saved, the engine checks the course in the address:
- The course must be a row that this person could choose in a
reffield of this form. It must exist, be in the current scope, and not be in a gone state. - When the route has two earlier parameters, they must belong together. On
/courses/{course}/grades/{assessment}/mark/new, the assessment must be in the course.
If a check fails, the answer is a 404. That is the same answer as for a course that does not
exist. So set course = :route.course always writes a course that the engine has checked.
The page’s access filter is not applied to the new row. A filter is about a stored row, and the
new row is not stored yet. The engine checks the course in the address as it checks a course that
the person chooses in a ref field.
This has a result that can surprise you. Suppose the page’s access rule is
teacher where course.owner = :user.id, so a teacher can open the assignments of their own
courses. A teacher can still open the create address of a course that another teacher owns, and
can save a new row there, because that course is one they could choose in a ref field. The
person who saved cannot then open the new row, because it is outside their filter: the page
after the save answers with a 404. A course that does not exist, or one that the person may not
choose, answers with a 404 when the form opens and when it is saved, and the engine writes
nothing.
To allow only some courses, add a deny when to the form. The engine checks it inside the save:
form of assignments { fields: title set course = :route.course deny when course.owner != :user.id "You can add an assignment only to your own course."}The form still opens for the other courses, and the save is refused.
The compiler refuses a new_route: value for the same reasons as a route: value, and also
these values:
| Refused | Reason |
|---|---|
a parameter that is not an earlier parameter of route:, such as new_route: /teachers/{teacher}/grades/new |
no ref path says what the parameter has to do with the new row |
an earlier parameter whose path starts at a parameter the new_route: does not carry, such as {course} without {assessment} when {course} is assessment.course |
there is no record on the create address, so the path must start at a parameter in the address |
one word, when route: does not end in a parameter, such as route: /members |
there is no parameter to replace. The message shows the full path to write instead. |
one word on a page without route: |
there is no route to put the word in |
a word with a hyphen or a dot, such as neu-anlegen |
write the full path instead. The message shows it. |
a value with a / that does not start with /, such as new/member |
a relative new_route: is one segment |
mode: modal| Value | Effect |
|---|---|
page |
the page opens at its own address, as a whole page. This is the default. |
modal |
see the status line below |
The compiler refuses every other value.
Status: the engine does not read mode: yet. A page with mode: modal renders as a whole
page at its own address, the same as mode: page.
width: widewidth: sets the width of the page’s content column. Every page uses the same column when it
has no width:. The header and the footer keep the default column on every page, so the menu
does not move between pages.
| Value | Content column |
|---|---|
no width: |
the default column, at most 68rem wide (1088px at the browser’s default text size) |
narrow |
a column for reading, at most 40rem wide (640px) |
wide |
at most 90rem wide (1440px) |
full |
the width of the browser window, with the normal padding on each side |
Each column is centred and never wider than the browser window. On a screen narrower than the
column, every value is the width of the screen. The regions inside the column keep their own
layout: a report still scrolls sideways when its table is wider than the column.
The compiler refuses every other value, and it names the three. It refuses a second width:
line in one page.
The width applies to the page at its own address. It does not apply to:
- a page opened in a dialog by
add_via:, which is the dialog’s own size; - an export of a region, which is a file;
- a print of the page.
Use narrow for a page that is read, such as one detail. Use wide or full for a report,
a sheet or a matrix with many columns.
row { stats of members "Members by status" { group_by: status } chart of members "Joined per month" { x: month(joined_on) y: count last: 12 }}row puts two or three regions beside each other, in columns of equal width. On a screen
narrower than 48rem (768px at the browser’s default text size) the regions stack in the order
you wrote them. A row is written in the page’s body, between other regions. A page can have
several rows.
A row holds these items: list, stats, chart, note, detail and form. Each keeps its
own layout in its column. A region inside a row is the same region as outside it: it has the
same access, the same where: and the same export. Its address in an export, and its id in a
form, do not change when you put it in a row or take it out.
A reader who cannot open a region in the row does not get that column. The other regions share the width. When a reader can open none of them, the row shows nothing.
The row applies to the page at its own address. A page opened in a dialog by
add_via:, an export,
and a print show the regions one below the other.
The compiler refuses these rows:
| Refused | Reason |
|---|---|
a report, sheet, matrix, versions or compare region in a row |
the region is as wide as its data. The message names the region and says to write it outside the row. |
| a row with no region | the row would lay out nothing |
| a row with more than three regions | three columns is the most that a column can hold. The message is at the fourth region. |
a row inside a row |
a page has one level of rows |
data, var, a page property or an access block in a row |
they belong to the page, not to a column. Write them before the row. |
row with no { after it, such as row -> member |
at page level, row is this block. A row -> link is written inside a region. |
A row with one region compiles with a warning. It draws as if the row were not there. See Errors and warnings.
form of members { }
aside "About this member" { list of :member.payments "Payments" { columns: paid_on, amount limit: 5 } note { text: "Fees are billed per season." }}aside puts one pane beside the page’s content. On a screen 48rem (768px) or wider the pane is
a column of 18rem (288px) beside the rest of the page, and it stays in view while the page
scrolls. On a narrower screen the pane is part of the one column, at the place where you wrote
it. width: widens the pane and the content together.
The label is required. It is the heading of the pane and the name a screen reader gives it.
Which side. The side comes from the place in the page:
| Written | Side |
|---|---|
| first, before every region and note of the page | before the content: the left in a left-to-right language, the right in a right-to-left language |
| last, after every region and note | after the content: the right in a left-to-right language |
There is no left or right keyword. The reading order, the keyboard order and the visual
order are the same. A data row and a var show nothing and can be written before or after
the pane.
What it holds. The items a row holds: list, stats, chart, note, detail
and form, one or more of them. A region in an aside is the same region as outside it: it has
the same access, the same where: and the same export. Its address in an export, and its id
in a form, do not change when you put it in an aside or take it out. A reader who cannot open a
region in the pane does not get that region. When the reader can open none of them, there is no
pane, and the content takes the whole width.
A list of records beside one record. When a list in the pane links each row with
row -> to the page the pane is on, the row that the page shows is marked as the current one
in the list. See Show related records beside a form.
The pane applies to the page at its own address. A page opened in a dialog by
add_via:, a page with
mode: modal, an export, and a print show the items one below the other.
The compiler refuses these asides:
| Refused | Reason |
|---|---|
an aside with no label |
the label is the pane’s name |
an aside between two regions |
a pane sits at one end of the page. Write it first or last. |
a second aside on one page |
a page has one pane. The message names the first. |
a report, sheet, matrix, versions or compare region in an aside |
the region is as wide as its data. The message names the region and says to write it outside the aside. |
an aside with no region |
the pane would show nothing |
a row inside an aside, or an aside inside a row or an aside |
a page has one level of rows and asides |
data, var, a page property or an access block in an aside |
they belong to the page. Write them outside the aside. |
An aside with one region is a normal pane. It compiles without a warning.
Status. A pane that the reader can close and open is not built. The pane has one width.
timezone
Section titled “timezone”timezone: usertimezone: sets the time zone that the page shows datetime values in and reads them from a
form in. Stored values stay UTC.
| Value | Effect |
|---|---|
app |
the application’s timezone:. This is the default. |
user |
the time zone that the reader selected, or the application’s time zone. The page header shows a selector. |
UTC or an IANA name Area/Location |
that time zone, whatever the application declares |
When a page shows a time zone other than the application’s, the page header names that time
zone. timezone: does not change today, now, or which rows a region shows.
The compiler refuses an abbreviation such as CET, and a name that is not in the IANA database.
For the task, read Set the time zone.
access
Section titled “access”access: board, traineraccess: publicaccess says which roles can open the page, and which records each role can see. It is
mandatory. A page with no access is a compile error, because the page would render for nobody.
Write access: public for a page that needs no sign-in.
access has two forms: a property with a list of roles, and a block with one rule per role. The
syntax, the names you can use and the refusals are on
Access rules and rights. For a walkthrough, read
Control who sees what.
On a page, the rule has these effects:
- A reader whom no rule admits cannot open the page.
- On a page that has a record, a
wherefilter of a rule applies to that record. A record that the filter excludes is a 404, the same as a record that does not exist. - On a page whose route selects its record, a region over another table does not get the
filter. So the compiler refuses a
report,list,statsorsheetover another table, and amatrixaxis over another table, when itswhere:does not read the page’s record. Write a condition such aswhere: course = :course.id, or list a relation of the record:list of :course.enrolments. See Regions. - On a page that has no record, the filter applies to the rows of its listing.
- A region and a note can each have their own
access. Their rule narrows the page’s rule for that item.
The compiler refuses a page with access: public that reads a table under the application’s
scope. See Security.
data <name> of <table> where <condition>data loads the one row that the page is about. The where part is optional. The row is loaded
once, before anything on the page renders.
data event of eventsdata event of events where publisheddata me of members where id = :user.member_idThe page reads the row as :<name>. :event.title is the title of the row, and :event.id
is its id. A region names the row in row: :event, a where: compares with :event.id, and
text shows {:event.title}.
The name cannot be user or route, because the engine supplies :user and :route.
How the route finds the row
Section titled “How the route finds the row”The last parameter of the route selects the row. The compiler decides at compile time which column the parameter is compared with:
- When the parameter is the name of a column of the table, that column.
{slug}finds the row whoseslugis the value in the address. - When the parameter is
id, or has the name of thedatarow, the row’sid.{event}withdata event of eventsis an id. - Otherwise the parameter binds no row, and a page that does not read it is refused. See Route parameters.
A where is added to the parameter’s condition. Both must hold.
A route with no parameter selects the row by the where alone. On route: /profile, the line
data me of members where id = :user.member_id loads the reader’s own record. If several rows
match, the engine takes the row with the lowest id. A page with no parameter and no where
has nothing to select the row with. See the caution at the end of this section.
A where that reads a sensitive column needs a grant on every rule of the page. Whether the page
is found or answers 404 tells any reader something about the value. The compiler refuses the page
and names the column.
A page with {id} and no data row is about the row of its form or detail region. So
route: /members/{id} with form of members edits member 17 at /members/17.
A row that does not match is a 404
Section titled “A row that does not match is a 404”The whole page answers 404 in each of these cases:
- no row has the value in the address.
- the row does not meet the
where. - the row does not meet the
wherefilter of the reader’s access rule. - the row is outside the application scope that the reader chose.
- an earlier route parameter does not relate to the row.
All of these give the same 404, and the page does not render partly. So an address cannot tell
a reader that a row exists. A title such as "Sign up: {:event.title}" is therefore safe: an
unpublished event has no page, so its title is never shown. Read
A refusal does not tell a stranger what exists.
On a route whose parameter is an unguessable column, a client that misses more than 30 times
in one minute gets 429 instead of 404.
What a where can read
Section titled “What a where can read”The where is the query that loads the row. It can read the row’s own columns, :user.…,
:route.…, today and now.
The compiler refuses these conditions:
- a condition that reads the
datarow itself, such aswhere :event.published. Write the column:where published. - a condition that reads another
datarow. - a condition that reads a
var. A var is computed after the rows are loaded. Put the condition in a note’swhen:or in adeny when. - a table that the application does not declare.
A page value is one stored column
Section titled “A page value is one stored column”A page value, such as :signup.event, is one stored column of the data row. The page loads
that row once and does not load any other row. The compiler refuses a path that goes past the
column:
- a path through a
ref, such as:signup.event.capacity. It needs the row thateventpoints at, and the page did not load that row. - a state flag of a lifecycle column, such as
:post.status.public. The column holds the name of the state, and the flag is not a column.
The refusal is the same in every place that reads a page value: a var, a note’s when:, a
region’s where:, a matrix axis’s where:, a set, a deny when, a calendar export’s
alarm_before: and upcoming:, and the text of an interpolation such as {:signup.event.title}.
pages/signup.mtd:9:13: ":signup.event.capacity" steps through the reference "event", and a page parameter binds one stored column of its data row: the row event points at is not loaded with the page declare the referenced row as a data row of the page — data <name> of events, found by a route parameter — and read :<name>.capacity; or store the value on signups and read it as :signup.<column>These spellings work:
| You want | Write |
|---|---|
the id of the row a ref points at |
:signup.event |
the name of the row a ref points at, in text |
{:signup.event}. It shows the display of the row. |
a value of the row a ref points at |
a page about that row: data event of events with a route parameter that finds it, then :event.capacity. Or store the value on the row that the page loads. |
| a test for a state flag | the comparison. If only published has the flag public, write :post.status = published. If more states have it, write :post.status in (published, scheduled). The repair line of the error names the states. |
| the state in text | {:post.status} |
A path in a region’s own query is different. In where: event.capacity > 3 on a region over
signups, the engine reads the path through the column of each row, and there is no colon.
A path through a column with the name of the data row
Section titled “A path through a column with the name of the data row”The compiler prints a warning when a region walks a path through a column that has the name of
the data row. The page still compiles and works.
data event of events
form of event_signups { fields: guest_name set event = :event.id deny when event.signups >= event.capacity "This event is full."}Here event_signups has a ref column event. In the form, event.signups goes through that
column to the event, and :event.signups reads the data row. The two differ by one colon. The
warning is at each path:
pages/signup.mtd:6:13: warning: event.signups walks the event column of event_signups, and the page's data row is also called "event": one colon apart, event.signups reads through the column and :event.signups reads the data row as the page loaded it rename the data row, e.g. data this_event of events, and write :this_event.… where :event.… reads it — keep the walk event.signups: it reads the region's own row, and in a deny when it reads it inside the writeA column name alone does not warn. where: event = :event.id and set event = :event.id are
the usual way to show or create the rows of one record, and they read as meant.
To remove the warning, rename the data row and change each :event.… on the page. Keep the
path event.signups. It is not the same as :event.signups: in a deny when, the path is read
in the same transaction as the save, so two sign-ups at the same moment cannot both take the
last place. :event.signups is the value from when the page loaded. When the route finds the
row by the name of the data row, as {event} does, rename the route parameter too. A route
parameter such as {slug}, which names a column, needs no change. See
Errors and warnings.
var <name> = <expression>var computes one value for each request. The page reads it as :<name>.
data event of eventsvar days_left = days_until(:event.signup_deadline)A var can read the data row, :user.…, :route.…, today, now, and the vars declared above
it. It can call the functions of the expression language, such as days_until, coalesce and
round. The engine computes every var after the data row is loaded and before anything
renders.
A var is used in text as {:days_left}, in a note’s when:, in a region’s where: and in a
deny when.
The compiler refuses these vars:
- a var that reads a column of the
datarow that has no stored value, such as:event.signupsfor acount. A page value is read from the stored columns of the row. The same holds for alist, amulti, a computed column (a column withvalue:), animgand afile, and for every other place that reads:<data row>.<column>. Show the column in a region. To calculate with it, add a computed column to the table. - a var that reads a path through a
refor a state flag, such as:signup.event.capacityor:post.status.public. See A page value is one stored column. - a var that reads a var declared below it. So a var cannot read itself through another var.
- a var that reads a column or a relation of a table directly. A var has no row. Load the row
with
data, and read:<data row>.<column>. - a var named
userorroute. - a var in an
accessrule or in adata … where. An access rule is decided before any row is read.
Regions
Section titled “Regions”A region shows rows of one table in one shape. A note shows text. They render in source order.
report of members "All members" { columns: name, email sort: name}| Region | Shows | Reference |
|---|---|---|
note |
text: guidance, a warning, up to three links, or one button for the next step. It reads no table. | note |
report |
rows of a table, with search, filters, sorting, pages and export | report |
list |
rows of a table in a layout for reading, with no search box and no filters | list |
detail |
the page’s record as an article: a line of fields and a body | detail |
stats |
counts of a table’s rows as tiles | stats |
chart |
one total per group of a table’s rows, drawn as columns, bars or a line | chart |
matrix |
a crosstab whose columns come from the data. It is read-only. | matrix |
versions |
the saved versions of the page’s record | versions |
compare |
two text columns of the page’s record, as a line diff | compare |
form |
one row, with a control for each field, to create or edit it | form |
sheet |
rows of a table as a grid of inputs, with one save | sheet |
Each region except compare and note names its table: report of members. compare names two
columns of the page’s record instead: compare pending_body with body.
Transition buttons
Section titled “Transition buttons”A page that is about one row of a table with a lifecycle shows the buttons of that row’s
transitions. The buttons are drawn with the page’s form of that table, or with its detail
when it has no form. A button is left out when the reader cannot perform the transition, and when
the row is not in one of the transition’s <from> states. A page with transition buttons accepts
a POST at its own address, like a page with a form.
The transitions are declared in the table, not in the page. See
transition.