Styles and view formulas
The same style statements work in two places:
| Data styles | View formulas | |
|---|---|---|
| Written in | A node file or Formula operation | A view’s conditional formatting |
| Marks | The data itself | What one view shows |
| Follows the data | Yes, into later nodes, groups, and every view | No, it belongs to its view |
| Knows the viewer | No | Yes, with me() and optionColor() |
| Changes data | Writes rows as any statement does | Never; it can change only the text a field shows |
Style statements
Section titled “Style statements”| Statement | Effect |
|---|---|
setStyle(field, key, value) |
Sets one style key on one cell of the row |
setRowStyle(key, value) |
Sets one style key on the whole row |
clearStyle(field), clearStyle(field, key) |
Removes every key, or one key, from a cell |
clearRowStyle(), clearRowStyle(key) |
Removes every key, or one key, from the row |
Style calls chain in any mix, across lines:
if( prop("Reporting GP").contains("Partners"), setStyle("Reporting GP", "icon", "thumbsup") .setStyle("Reporting GP", "text_color", "indigo"))Style keys
Section titled “Style keys”| Key | Value |
|---|---|
background |
Colour token: background |
background_strong |
Colour token: a stronger background |
text_color |
Colour token: text colour |
border_top, border_right, border_bottom, border_left |
Colour token: one border |
dot |
Colour token: a colour dot before the value |
icon_color |
Colour token: the icon’s colour, otherwise the text colour |
bold, italic, underline, strikethrough |
true or false |
size |
"large" or "small" |
icon |
An icon by its name in the asset library, such as "thumbsup", or a Heroicons reference such as "heroicons:outline/star" |
A colour token is a name from the colour chooser, such as lime, indigo, rose, sky, or gray. A literal that is not a token is a type error that lists the valid ones. Field names and style keys are text literals.
When two writes set the same key on the same cell for one row, the later one wins. A value that is empty writes nothing.
Data styles
Section titled “Data styles”In a node file, a style marks the data, and the mark follows every value computed from it:
setStyle("Dirty Price", "background", "rose")setProp("Consideration", prop("Dirty Price") * prop("Quantity"))Consideration is rose too, because it was computed from a rose cell. The marks ride on the node’s output, so they stay with the rows through later statements and nodes, into groups, and in every Explore view that shows them.
- Value reads pass marks on: a cell read to compute a value is a source. A cell read only to decide something, in an
ifcondition, a filter, or a sort key, passes nothing on. - Constants clear marks: writing a cell from a constant clears the marks it had.
- Groups keep the union: where many rows become one, the group row keeps the union of its members’ marks.
- Lookups bring marks along: a value read out of another wire’s table carries that cell’s marks, so an enriched column keeps the marking of the column it came from.
- Whole-row steps: an AI call or a script gives every cell of its output row the union of the input row’s marks; a query carries none. Formula statements are the steps that keep marks per cell.
- Never a run failure: an unusable colour, size, or icon skips that write and reports it on the node; the data is written as normal.
Set a style where data enters, such as setStyle("ISIN", "background", "pink") right after loading a source, and a cell three nodes downstream still shows where it came from. See Data lineage.
View formulas
Section titled “View formulas”A view formula is the conditional formatting of a table, board, list, calendar, timeline, or details view. It runs on every row the view shows, one row at a time, top to bottom, and never changes the stored data.
if(test(prop("Fund ID"), "14$"), setStyle("Fund ID", "background", "lime"))
if(prop("NAV") < prop("Commitment"), setStyle("Fund name", "text_color", "rose"))
setStyle("Status", "dot", optionColor("Status"))
if(prop("Assignee").includes(me()), setRowStyle("background", "sky"))What a view formula can use
Section titled “What a view formula can use”- Statements: the style statements,
setPropto change the text a field shows,if, anddo. Every row statement (filter,groupBy,dropRow,raiseException, …),context(), andinputs()are type errors in a view formula. - Expressions: every expression function,
let, andlets, as in a node file. me(): the signed-in viewer’s name, or empty where the view has none:prop("Assignee").includes(me()).optionColor(field): the colour of the option a select, status, or multi-select field holds, or empty when it has none.me()andoptionColor()belong to view formulas only.
Fields in a view
Section titled “Fields in a view”Fields are named as the view shows them. Select and status fields read as the option name (text), multi-select and people fields as a list of names, date fields as dates, checkboxes as booleans, numbers as numbers, and every other field as text. Renaming a field does not rewrite the formula.
Changing the text a field shows
Section titled “Changing the text a field shows”setProp(name, value) in a view formula is display only: the view shows the value as format() renders it, while sorting, filtering, search, grouping, editing, and export keep the stored value.
if(empty(prop("Amount")), setProp("Amount", "N/A"))Rows and fields
Section titled “Rows and fields”Row and field styles are separate layers. The row layer paints whatever shows the row: the whole row in a table, the card on a board, the item in a list, the chip on a calendar, the label beside the bar on a timeline, the record in a details view. A field background sits above the row background, and the row’s text styles reach every field that does not set that key itself.
Where data styles and a view formula paint the same cell, the data styles go on first and the view formula overrides only the keys it sets.
Errors in a view formula
Section titled “Errors in a view formula”A run error fails only its row: that row gets no styles, every other row still paints, and the editor lists the failing rows with their messages. Guard blank numbers before comparing them:
if( not(empty(prop("NAV"))) and not(empty(prop("Commitment"))) and prop("NAV") < prop("Commitment"), setStyle("Fund name", "text_color", "rose"))A formula with a type error paints nothing until it checks clean.
Related
Section titled “Related”- Exception management: view formulas on exception views
- Styles and viewer functions
- Worked examples:
style-lineage-trade-considerationand theview-…examples