Named values
A named value is a value worked out by the portal and read by name, as values.<name>, in any action list or logic flow. A VAT rate, a greeting, a price list from a flow: each is written once and kept for a while.
A value
Section titled “A value”A value lives in values/<name>.yaml. The file’s name is the value’s name: letters, digits and _, starting with a lower-case letter.
name: ro: Cota TVA en: VAT ratecache: installttl: 3600value: "1.19"A value is one of:
value: an expression;flow: a flow’s outputs, withflow: { id, inputs }. Read one output asvalues.<name>.<output>.http: what a service answers, withhttp: { connector, path, query }.- It is a GET through a web connector.
- The value is the answer’s body.
- An answer that is not 2xx fails it.
- A value kept for the whole portal or a site cannot use a connector that each person connects themselves.
collection: the published entries of a content collection, withcollection: <id>.- Each entry is
id,slugandvalues. - It is read before the list runs, and is as fresh as the value’s
ttl. - Only a public collection that visitors may read can be a value, since a value may reach anyone. Each entry’s values are shown in the run’s language.
- Each entry is
A value never reaches the portal’s files: a value kept for others must not hold what only some people may read.
How long it is kept
Section titled “How long it is kept”cache says for whom a value is kept, and ttl how many seconds (1 to 86,400; 300 when left out):
cache | Kept for | Its expression may read |
|---|---|---|
install | The whole portal | locale, now, other install values |
site | Each site | as above, and site and site values |
user | Each signed-in person | as above, and user and user values |
none | Nobody: worked out every time | everything above |
A value is kept per language too. A value kept for a site or the whole portal never sees the person, even inside a flow it calls: what it keeps is the same for everyone. A value cannot read a value kept for fewer people than it is, and values cannot read each other in a circle. The portal refuses either when the file is saved. A user value is never kept for visitors.
Kept values start afresh whenever the portal’s files change.
When a value fails
Section titled “When a value fails”Every value a list can reach is worked out before the list runs, each after the values it reads. A value that fails is left out, and the run’s log says why. Reading it is then the action’s error, which its onError can catch.
Values are read as values.<name>. Any other way, such as values["name"], is refused when the file is saved.