Use expressions to calculate, convert, compare, or provide a fallback for variables before using them in a field.
Only fields that support expressions display the fx icon. Common locations include inputs that support variables and variable selectors in conditions such as IF/ELIF. If you only need to use an upstream variable as-is, select it from the variable picker instead of creating an expression.
When to use expressions
Expressions are useful when you need to:
- Calculate values such as amounts, quantities, or durations
- Check whether text contains a keyword
- Convert numeric text returned by a form or API into a number
- Provide a fallback for an empty string or empty array
- Retrieve a field from an object or array
Create an expression
1. Select fx in the target field.
2. In the Expression editor, enter / or { to insert an available variable from the list. To add a function or operator, select the function icon in the upper-right corner of the editor, insert a template, and complete its parameters.
3. Select Insert to save the expression as the value of the field. Select the expression again to edit it.
Insert variables from the list instead of typing node or variable names manually. This helps prevent invalid references.
Supported syntax
An expression can reference variables, retrieve object fields or array items, use constants, and perform calculations or comparisons.
Retrieve object fields and array items
Use . to retrieve fields from an object and [index] to retrieve an item from an array:
user.profile.name products[0] products[0].name
user.profile.name retrieves the name field from the profile object within user. Array indexes start at 0: products[0] refers to the first item in the products array, and products[0].name retrieves that item's name field. Consecutive indexes are not currently supported, such as matrix[0][1].
Operators
| Type | Operators | Example |
|---|---|---|
| Numeric calculations | + - * / | order.amount * 0.9 |
| Numeric comparisons | > < >= <= | order.amount > 100 |
| Equality comparisons | == != | order.status == "paid" |
Numeric operators can only be used with numbers and cannot be used to join text. Comparison expressions return true or false.
Built-in functions
| Function | Description | Example |
|---|---|---|
| len(value) | Returns the length of text or the number of items in an array | len(searchResults.items) |
| sqrt(number) | Returns the square root of a non-negative number | sqrt(room.area) |
| round(number, digits) | Rounds a number to the specified number of decimal places | round(order.amount / 3, 2) |
| contains(text, searchText) | Checks whether text contains the specified text | contains(userInput.text, "refund") |
| default(value, fallback) | Uses the fallback when the value is an empty string or empty array | default(user.name, "Guest") |
| toNumber(value) | Converts numeric text into a number | toNumber(form.quantity) |
Common examples
Set a dynamic wait time
round(toNumber(apiResponse.delaySecondsText), 3)
Converts a text value returned by an API into a number of seconds and keeps three decimal places.
Check whether the monthly budget is exceeded
monthlyBudget < monthToDateCost + currentRequest.cost
In an IF node, use this expression to check whether the total cost, including the current request, exceeds the monthly budget. When the condition is met, the result is true and the workflow can continue to an approval or notification branch.
Provide a fallback for an empty field
default(form.city, "Unknown city")
When the city field is an empty string, downstream nodes receive "Unknown city".
Limitations
Expressions are not a scripting environment. They do not support programming statements such as if, loops, or assignments, and they cannot call custom functions that are not listed above.
When you save an expression, the system checks whether its result matches the type required by the current field. For example, number fields should use numeric variables, numeric calculations, or toNumber.
Leave a Reply.