Workflows
Expression functions
All inline expression functions — text, dates, math, logic, conversion, lists, regex, data and files — with signatures and examples.
Use these inside {{= … }} in any setting. Optional arguments are in brackets. The list is generated from the expression engine (lib/expression-functions.ts).
Text functions
| Function | Returns | Description | Example |
|---|---|---|---|
LEFT(text, length) | string | Get characters from the left of a string | LEFT("Example", 2) → "Ex" |
RIGHT(text, length) | string | Get characters from the right of a string | RIGHT("Example", 3) → "ple" |
MID(text, start, [length]) | string | Get a substring starting at a position | MID("Example", 3, 2) → "am" |
LENGTH(text) | number | Get the length of a string | LENGTH("Hello") → 5 |
UPPER(text) | string | Convert to uppercase | UPPER("hello") → "HELLO" |
LOWER(text) | string | Convert to lowercase | LOWER("HELLO") → "hello" |
TRIM(text) | string | Remove leading/trailing whitespace | TRIM(" hi ") → "hi" |
REPLACE(text, find, replace) | string | Replace occurrences in a string | REPLACE("hello", "l", "r") → "herro" |
FIND(text, search) | number | Find position of substring (1-based, 0 if not found) | FIND("Example", "amp") → 3 |
CONTAINS(text, search) | boolean | Check if string contains a substring | CONTAINS("hello", "ell") → true |
CONCAT(values) | string | Concatenate multiple values | CONCAT("a", " ", "b") → "a b" |
JOIN(separator, values) | string | Join a list with a separator | JOIN(", ", "a", "b") → "a, b" |
SPLIT(text, separator) | array | Split text into a list | SPLIT("a;b;c", ";") → ["a","b","c"] |
PAD_LEFT(text, length, [char]) | string | Pad string on the left | PAD_LEFT("5", 3, "0") → "005" |
PAD_RIGHT(text, length, [char]) | string | Pad string on the right | PAD_RIGHT("5", 3, "0") → "500" |
PROPER(text) | string | Convert to title case | PROPER("hello world") → "Hello World" |
URL_ENCODE(text) | string | URL-encode a string | URL_ENCODE("a b") → "a%20b" |
URL_DECODE(text) | string | URL-decode a string | URL_DECODE("a%20b") → "a b" |
Date & Time functions
| Function | Returns | Description | Example |
|---|---|---|---|
NOW() | string | Current date and time | NOW() → "2024-03-15T14:30:00" |
TODAY() | string | Current date (midnight) | TODAY() → "2024-03-15" |
ADD_DAYS(date, days) | string | Add days to a date | ADD_DAYS("2024-01-01", 7) → "2024-01-08" |
ADD_HOURS(date, hours) | string | Add hours to a date/time | ADD_HOURS(NOW(), 2) |
ADD_MINUTES(date, minutes) | string | Add minutes to a date/time | ADD_MINUTES(NOW(), 30) |
SUBTRACT_DAYS(date, days) | string | Subtract days from a date | SUBTRACT_DAYS("2024-01-08", 7) → "2024-01-01" |
DAY_DIFF(date1, date2) | number | Days between two dates | DAY_DIFF("2024-01-01", "2024-01-08") → 7 |
DAY(date) | number | Get day of month | DAY("2024-03-15") → 15 |
MONTH(date) | number | Get month number | MONTH("2024-03-15") → 3 |
YEAR(date) | number | Get year | YEAR("2024-03-15") → 2024 |
WEEKDAY(date) | string | Get day of week name | WEEKDAY("2024-03-15") → "Friday" |
FORMAT_DATE(date, format) | string | Format a date string | FORMAT_DATE(NOW(), "YYYY-MM-DD") |
START_OF_MONTH(date) | string | First day of the month | START_OF_MONTH("2024-03-15") → "2024-03-01" |
END_OF_MONTH(date) | string | Last day of the month | END_OF_MONTH("2024-03-15") → "2024-03-31" |
TOMORROW() | string | Tomorrow's date | TOMORROW() → "2024-03-16" |
YESTERDAY() | string | Yesterday's date | YESTERDAY() → "2024-03-14" |
Math functions
| Function | Returns | Description | Example |
|---|---|---|---|
ABS(number) | number | Absolute value | ABS(-5) → 5 |
ROUND(number, [digits]) | number | Round to precision | ROUND(1.567, 1) → 1.6 |
ROUND_UP(number) | number | Round up (ceiling) | ROUND_UP(1.1) → 2 |
ROUND_DOWN(number) | number | Round down (floor) | ROUND_DOWN(1.9) → 1 |
MIN(values) | number | Minimum of values | MIN(3, 1, 5) → 1 |
MAX(values) | number | Maximum of values | MAX(3, 1, 5) → 5 |
AVG(values) | number | Average of values | AVG(2, 4, 6) → 4 |
SUM(values) | number | Sum of values | SUM(1, 2, 3) → 6 |
POWER(base, exponent) | number | Raise to a power | POWER(2, 3) → 8 |
SQRT(number) | number | Square root | SQRT(9) → 3 |
MOD(number, divisor) | number | Modulo (remainder) | MOD(10, 3) → 1 |
RANDOM(max) | number | Random number 0 to max | RANDOM(100) → 42 |
FORMAT_NUMBER(number, decimals) | string | Format number with decimals | FORMAT_NUMBER(1234.5, 2) → "1234.50" |
Logical functions
| Function | Returns | Description | Example |
|---|---|---|---|
IF(condition, then, else) | any | If condition then A else B | IF(true, "Yes", "No") → "Yes" |
AND(values) | boolean | True if all values are true | AND(true, true) → true |
OR(values) | boolean | True if any value is true | OR(true, false) → true |
NOT(value) | boolean | Negate a boolean | NOT(true) → false |
COALESCE(values) | any | First non-empty value | COALESCE("", null, "hi") → "hi" |
IS_EMPTY(value) | boolean | Check if value is empty/null | IS_EMPTY("") → true |
Conversion functions
| Function | Returns | Description | Example |
|---|---|---|---|
TO_STRING(value) | string | Convert to string | TO_STRING(123) → "123" |
TO_NUMBER(value) | number | Convert to number | TO_NUMBER("42") → 42 |
TO_BOOLEAN(value) | boolean | Convert to boolean | TO_BOOLEAN("true") → true |
TO_JSON(value) | string | Convert to JSON string | TO_JSON({a:1}) → '{"a":1}' |
FROM_JSON(text) | any | Parse a JSON string | FROM_JSON('{"a":1}') → {a:1} |
List functions
| Function | Returns | Description | Example |
|---|---|---|---|
COUNT(list) | number | Count items in a list | COUNT([1,2,3]) → 3 |
FIRST(list) | any | First item in a list | FIRST([1,2,3]) → 1 |
LAST(list) | any | Last item in a list | LAST([1,2,3]) → 3 |
INDEX(list, index) | any | Get item at index (1-based) | INDEX([a,b,c], 2) → "b" |
REVERSE(list) | array | Reverse a list | REVERSE([1,2,3]) → [3,2,1] |
UNIQUE(list) | array | Remove duplicate values | UNIQUE([1,2,2,3]) → [1,2,3] |
FLATTEN(list) | array | Flatten nested arrays | FLATTEN([[1,2],[3]]) → [1,2,3] |
PLUCK(list, key) | array | Extract one field from every item into a list (dotted paths like "address.city" work) | SUM(PLUCK(items, "price")) |
FIND_WHERE(list, field, value, [return_field]) | any | First item whose field equals a value — optionally return one field of it | FIND_WHERE(customers, "id", 42, "email") → "ada@example.com" |
FILTER_WHERE(list, field, value) | array | All items whose field equals a value | COUNT(FILTER_WHERE(orders, "status", "open")) |
Regex functions
| Function | Returns | Description | Example |
|---|---|---|---|
REGEX_MATCH(text, pattern) | boolean | Test if text matches a pattern | REGEX_MATCH("abc123", "\\d+") → true |
REGEX_EXTRACT(text, pattern) | string | Extract first match | REGEX_EXTRACT("abc123", "\\d+") → "123" |
REGEX_REPLACE(text, pattern, replacement) | string | Replace matches with a string | REGEX_REPLACE("a1b2", "\\d", "X") → "aXbX" |
Data functions
| Function | Returns | Description | Example |
|---|---|---|---|
GUID() | string | Generate a new UUID | GUID() → "a1b2c3..." |
BASE64_ENCODE(text) | string | Encode string to Base64 | BASE64_ENCODE("Hello") → "SGVsbG8=" |
BASE64_DECODE(text) | string | Decode Base64 to string | BASE64_DECODE("SGVsbG8=") → "Hello" |
File functions
| Function | Returns | Description | Example |
|---|---|---|---|
FILE_NAME(path) | string | Extract filename from path or URL | FILE_NAME("/docs/report.pdf") → "report.pdf" |
FILE_EXT(path) | string | Extract file extension | FILE_EXT("report.pdf") → "pdf" |
FILE_BASE_NAME(path) | string | Filename without extension | FILE_BASE_NAME("report.pdf") → "report" |
MIME_TYPE(filename) | string | Get MIME type from extension | MIME_TYPE("doc.pdf") → "application/pdf" |
FILE_SIZE_FORMAT(bytes) | string | Format bytes to human-readable | FILE_SIZE_FORMAT(1048576) → "1.0 MB" |
DATA_URI(base64, mimeType) | string | Build data URI from base64 + mime | DATA_URI("SGVs...", "text/plain") |
DATA_URI_BASE64(dataUri) | string | Extract base64 from a data URI | DATA_URI_BASE64("data:text/plain;base64,SGVs...") → "SGVs..." |
DATA_URI_MIME(dataUri) | string | Extract MIME type from a data URI | DATA_URI_MIME("data:text/plain;base64,...") → "text/plain" |