Skip to content

Formula

Formula is the language every workflow step is written in. A node’s behaviour is a list of formula statements that runs top to bottom: one statement loads a file, the next renames a column, a check raises an exception on a bad row, and the last one saves the result. The same expressions also drive the conditional formatting of a view.

The expressions are Notion Formula 2.0, so prop("Name").upper() works as it does in Notion. Fontana adds row statements (setProp, filter, groupBy, raiseException, …) and verbs that move data in and out of a node (fromFile, toFile, fromApi, fromAi, …).

This node file loads a CSV, maps and types its columns, checks them, derives a value, filters, aggregates, and saves the result:

# Load
fromFile("../trades.csv")
# Map and type the columns
setProp("ISIN", trim(prop("isin")).upper())
setProp("Quantity", prop("qty"))
setType("Quantity", "number")
setProp("Price", prop("px"))
setType("Price", "number")
keepProps("ISIN", "Quantity", "Price", "desk")
# Validate
if(
not(isValidIsin(prop("ISIN"))),
raiseException("ISIN", prop("ISIN"))
.setProp("message", "Not a valid ISIN")
.setProp("severityLevel", 4)
)
# Transform
setProp("Consideration", round(prop("Quantity") * prop("Price"), 2))
# Filter
filter(prop("Quantity") > 0)
# Aggregate
groupBy(prop("desk"))
setProp("desk", prop("desk").first())
setProp("Consideration", prop("Consideration").sum())
keepProps("desk", "Consideration")
# Export
toFile("../out/consideration-by-desk.xlsx")

Each stage has its own page:

Stage Statements Page
Load fromFile, fromWeb, fromApi, fromGraphql, fromEmail, fromRequest, named tables from wires, subgrid Load data
Map setProp, setType, keepProps, unsetProp, rowKey, splitRows for nested lists, spreadProps for nested objects Map and shape columns
Validate if(…, raiseException(…)), each, severities and keys Validate data
Transform Text, number, date, logic, and list functions; context() Transform values
Generate insertRow, splitRows, rowIndex, fromAi, fromTemplate, fromQuery, fromScript Generate rows and values
Filter and sort filter, dropRow, sortBy, desc Filter and sort
Aggregate groupBy and the list reducers Group and aggregate
Combine inputs(), find, findAll, appendRows Combine tables
Export toFile, toEmail, toApi, toGraphql Export data
Style setStyle, setRowStyle, view formulas Styles and view formulas
Place What the formula does
A node file The whole step: verbs, shaping statements, and formula statements, in one .ffl file beside the workflow. See Formula node.
A Formula operation Formula statements over the rows one operation receives, inside a node’s list of operations.
A view’s conditional formatting One row at a time, styling what a table, board, list, calendar, timeline, or details view shows. See Styles and view formulas.
A node’s trigger condition One expression that decides whether the node runs, such as holding an export back while upstream exceptions are open. See Export data.
  • Lineage per cell: every cell a statement writes records the cells it was computed from, so you can trace any output value back to its sources. See Data lineage.
  • Data styles follow the data: a mark you set on a source column follows every value computed from it. See Styles and view formulas.
  • Checked before it runs: the editor type-checks every statement against the columns that reach it, so an unknown column or a wrong type shows as you type.
  • Exact numbers: every number is an exact decimal while a formula computes, so 0.1 + 0.2 is 0.3.
  • Readable as cards and as text: the node editor opens on statement cards; Code on the left of the header shows Formula text. Click an English sentence on a card to edit it. See Write formulas in Flow.