--- title: 'Expression Functions' description: 'Transform values inline inside {{...}} references — round, format dates, branch on conditions, and more.' --- # Expression Functions Anywhere a field accepts `{{...}}` data references, you can also call **functions** to transform the value inline — no extra Transform node needed: ``` {{round(trigger.data.amount, 2)}} {{if(trigger.data.vip, "gold", "standard")}} {{upper(trim(trigger.data.name))}} {{formatDate(trigger.data.created_at, "YYYY-MM-DD")}} ``` Functions nest freely, take data paths, quoted strings, numbers, `true`/`false`/`null` as arguments, and follow the same type rules as plain references: a field that is exactly one `{{...}}` expression keeps the result's real type (number stays number); mixed text stringifies it. If an expression can't be parsed or a value has the wrong type, it resolves to empty — the same as a missing field — never a crash. Find them in the **ƒ Functions** button on the variable-picker toolbar (inserting drops `{{name()}}` with the parentheses ready to fill). ## General | Function | Does | |---|---| | `if(condition, then, else)` | Returns *then* when the condition is truthy (empty string, 0, false, null count as falsy). | | `ifempty(value, fallback)` | The fallback when the value is missing or `""`. | | `coalesce(a, b, …)` | The first argument that isn't missing. | | `switch(value, case1, out1, …, default?)` | Compares the value against each case; returns the matching output. | ## Math | Function | Does | |---|---| | `round(number, digits?)` · `floor` · `ceil` · `abs` | Rounding + absolute value. | | `sum(array)` · `avg(array)` · `min(array)` · `max(array)` | Aggregate an array of numbers. | ## Text | Function | Does | |---|---| | `trim` · `lower` · `upper` · `capitalize` | Whitespace + case. | | `replace(text, find, replacement)` | Replace every occurrence. | | `substring(text, start, end?)` · `length(text\|array)` | Slicing + length. | | `split(text, separator)` · `join(array, separator)` | Between strings and arrays. | ## Date & time | Function | Does | |---|---| | `now()` · `timestamp()` | Current time (ISO string / epoch ms). | | `formatDate(date, "YYYY-MM-DD HH:mm:ss")` | Format any date value (UTC). | | `addDays(date, days)` | Shift by whole days (negative works). | | `parseDate(text)` | Normalize a date string to ISO. | ## Arrays | Function | Does | |---|---| | `first(array)` · `last(array)` · `count(array)` | Item access + count. | | `distinct(array)` · `flatten(array)` | De-duplicate / flatten one level. | | `toJson(value)` · `fromJson(text)` | To/from JSON strings. | ## Gotchas - **No arithmetic operators** — `{{a + b}}` is not an expression; use the functions (`sum`, or a Transform node for complex math). - **Function names are fixed** — an unknown name resolves to empty rather than erroring. - Date/time **system variables** (`{{$now}}`, `{{$today}}`, …) still work and can be passed into functions: `{{formatDate($now, "DD/MM")}}`.