Skip to content

Write formulas in Flow

You write a formula in the node editor. Every node has a node file, a .ffl file of statements beside the workflow. The editor opens on statement cards. The Code button on the left of the header shows the same file as Formula text.

View What you see Use it to
Cards (default) One card per statement. Load and similar steps keep their fields. Column steps (setProp, setType) show the English sentence. Keep shows column chips until you click them. Set a file path, pick columns, or change a step in English
Formula The statements as text, with highlighting and checking Write and edit formulas directly

Press Code on the left of the editor header to open Formula. Press it again to return to cards.

Cards are coloured by what their statement does: loading and saving amber, AI purple, changes to rows and columns blue, checks green, and styling pink. The node’s strips on the canvas use the same colours.

A field that takes a credential holds a workspace secret as secret("NAME"), picked by name from a padlock chip. The secret’s value never enters the file.

On a statement card, and in a Formula operation’s badge, every statement reads as a sentence that Fontana writes from the formula itself, so the sentences always describe what runs. setProp("lei", prop("lei").upper()) reads Make lei uppercase. Click the sentence (or a Keep column chip) to edit it in place.

The English is an editor. Change a sentence, add new ones, or delete them, and type / to pick a column or a file from a list that narrows as you type. A column goes in as its name in backticks, a file as its path in quotes. Then press Process to turn your changes into formula:

  1. A sentence written the way Fontana writes it converts directly, shown at 100%.
  2. Any other wording goes to Fontana’s formula model, Fluid, which proposes a formula with its confidence.
  3. Each changed sentence then shows what it resolved to, in English and as the formula change. Accept, reject, or edit each one, or all at once.

Sentences you did not change keep their formula, even when you move them. If you name a column loosely, such as Fund for Fund Name, the formula uses the one column that name fits. When the model cannot produce a formula that checks, the box shows what it wrote with the errors, so you can fix it and accept it. The first Process after a long pause can take about two minutes while the model loads; a progress bar shows how far along it is.

You can write checks and styles in plain English too: isin starts with ‘GB’ is a pattern test, and Make Account ID red if Company valuation is above 130 million. becomes a conditional style.

A line that starts with # is a comment: it shows in gray, stays in the formula, and is never converted.

The editor checks every statement against the columns that reach it, so mistakes show before the node runs:

  • Unknown names: a column that does not exist (Cannot find property "Name") or a function that does not exist (Cannot find function len()).
  • Wrong types: a text where a number is expected, or a setProp that writes a different type into an existing column.
  • Misplaced statements: groupBy inside an if, desc outside sortBy, or a context key read before it is written.
  • Order warnings: rowIndex() after a filter, sortBy, or groupBy, naming that statement, because the position no longer matches the arrival order.

The editor knows the input columns plus every column an earlier statement set. After a query or a script, which can add columns the editor cannot see, an unknown column is typed any instead of reported. See Errors and limits.

The node picker offers each common step as a preset that starts a node file with that statement, such as Load a file (fromFile), Save to a file (toFile), Ask AI per row (fromAi), or Set a column type (setType). While a node’s editor is open, double-click a preset, or drag it onto the editor, to add its statement to the end of that node’s file. Undo removes it. See Formula node for every preset.

A node file lives beside the workflow, in a folder named after it: <workflow name>-scripts/<node id>.ffl. For orders.wf.json that is orders-scripts/. Open it from the node, or in Fontana Files as Source. Paths inside a node file are relative to the node file, so ../orders.csv is the file beside the workflow.

One .ffl file can hold several formulas. Open a fence with three backticks then ffl and a name, write the statements, and close it with three backticks:

```ffl normalise
setProp("ISIN", trim(prop("ISIN")).upper())
setProp("side", prop("side").upper())
```
```ffl drop_cancelled
filter(prop("status") != "CANCELLED")
```

An export name is letters, digits, and _, starting with a letter or _. Point an operation at one export with a JSON Reference, lib.ffl#normalise. A file is either unfenced, where the whole file is the default export, or named, where every export is a fence; one file never mixes the two. See JSON References.

A node can also host formula statements as one operation in its list of operations. The operations before it finish on every row, the formula runs on that row array, and the operations after it see the formula’s output. Editing a referenced .ffl re-runs that operation and the ones after it, and leaves the rest of the node alone.

  • Badge: the operation’s badge shows the formula as plain English, with Process, Cancel, and the other formula buttons in its header. When the badge is narrow, the buttons that do not fit move into its … menu.
  • Raw view: the code icon on the badge opens the whole formula as Raw text, with the function help under it.
  • Turned off: you can edit the formula while the operation is turned off; turning it off skips the run, not the editor.
  • Explore tab: the data is the table on the left and the operations list is the column on the right. Close the column with the X on its toolbar, or with the panel control on the right of the node-editor tabs, and drag the split to change its width.
  • Storage: a new formula on a Workspace workflow is stored as an .ffl file next to the workflow, and the operation points at it with a JSON Reference.

The recommended operation. Notion-style formula statements over the row array: set fields, drop rows, sort, group, aggregate, raise exceptions, read the host's other wires with inputs(). Carries lineage and styles.

Parameters

  • formula (Formula, string, required): Formula statements. Each statement receives the current rows and returns the next rows; the last rows are the operation output. Default: "".

Field selection

Formula does not use params.source or params.target. Its statements read fields with prop("Exact schema name") and write them with setProp, and the host's other wires with inputs(). Every function is listed in Formula functions.

JSON Configuration

{
"id": "op-formula",
"kind": "formula",
"params": {
"formula": "setProp(\"Side\", prop(\"Side\").upper())"
}
}