package page→ /base/fields.md
pages/base/fields.md
25 lines, 2.1 KB. As a page.
- ---
- type: Page
- title: "Kinds of fields"
- icon: "🏷️"
- description: "Which fields the records of a collection can have: the kind of field, what it holds, how it is described in the schema and what is checked."
- ---
- A record field is described in the collection schema, in `properties:` of its page: the field name, its kind (`kind`), the label (`label`) and the parameters of the kind. Any field can have `required: true` (always filled) and `requiredWhen: {field: [values]}` (filled when another field, usually the state, takes one of the values).
- | Kind | What is in the field | Parameters in the schema | What is checked |
- |---|---|---|---|
- | `text` | free text | none | only requiredness |
- | `select` | one value from a list | `options: [{name, label, color}]`; `multiple: true` for several values | the value is among `options` (SCH-R02) |
- | `relation` | the path of a record of another collection, for example `/work/initiatives/i-01` | `collection`: where it points; `multiple: true` for several paths | the record exists and lies in this collection (SCH-R01) |
- | `phase` | the state of a record: the name of a contour phase | `contour`: the path of the contour | package `contours`: the value is a phase of this contour |
- | `date` | a date | none | the form `YYYY-MM-DD` (SCH-R02) |
- | `number` | a number | none | a number (SCH-R02) |
- | `checkbox` | a checkbox | none | `true` or `false` (SCH-R02) |
- | `rollup` | a rollup: the number of records of another collection that refer to this one | `from`: the collection, `via`: the relation field in it, `measure: count` | computed, not written by hand |
- | `url` | an address in the outside world | none | only requiredness |
- | `files` | attached files | none | only requiredness |
- A relation is written in the lower record and points up; each relation has one stored direction. Back links are computed (a rollup) and are not created by hand. A link in the text of a page does not count as a relation.
- An empty value (no field, an empty string, an empty list) is skipped by the value check: emptiness is caught only by requiredness (SCH-R03).