Functions
There are no functions inside {{ }}. An expression only looks a value up. Arithmetic, comparisons, method calls such as .toLowerCase() or .length, ternaries and functions such as now() or formatDate(…) are not evaluated.
This keeps expressions predictable and safe: a value from a web page or a form can never run as code. Computation happens in nodes, where you can see it, test it and audit it.
What happens if you try
| You write | What you get |
|---|---|
{{ $input.subtotal + $input.tax }} |
Not a sum. An [EXPR-ERROR: …] marker. |
{{ $input.email.toLowerCase() }} |
Not lower-cased. toLowerCase() is read as a field name, so you get an [EXPR-ERROR: …] marker. |
{{ $node["List"].output.items.length }} |
Not a count. length is read as a field name, so you get an [EXPR-ERROR: …] marker. |
{{ now() }}, {{ $now }} |
Left as literal text. Neither is a Flero root. |
{{ $input.name || "Anonymous" }} |
Not a default. It resolves to null. |
Earlier versions of these docs listed arithmetic and a few string methods inside expressions. Flero does not evaluate them.
Use a node instead
| You need | Use |
|---|---|
| Build a URL or a message from several values | Several blocks in one field: https://{{ $env.API_HOST }}/users/{{ $trigger.payload.userId }} |
| Upper case, lower case, trim | Set node globalTransforms, for example {"lowercase": ["email"], "trim": ["name"]} |
| A default when a field is missing | Set rule with allowOverwrite: false (it only writes a key that isn't there yet), or ?? in a Code node |
| Join fields | Text with several blocks, or a Data Transform concat |
| Count, sum, average, min, max of a list of numbers | Data Transform aggregate |
| Filter, sort, group, flatten a list | Data Transform |
| Arithmetic | Code. Data Transform's calculate only adds fields together. |
| Format or shift a date | Date & Time, or Code |
| Regex, sentiment, diff | Text Processing |
| Choose between two values | An If node with a Set node on each branch, or Code |
| A later item of a multi-item output | No function needed: {{ $node["List Orders"].output._items[2].id }} |
| Embed an object as JSON text | Put it inside other text: Payload: {{ $node["Data"].output.response.body }}. Lists and objects are written as JSON. |
| Anything else | Code |
Example: add tax, then use the result.
// Code node "Totals" (JavaScript)
const o = input[0];
return { total: o.subtotal + o.tax };Downstream: {{ $node["Totals"].output.total }}.
Expressions inside Code
You can put {{ … }} blocks in a Code node's script. Each block is handed to the script as a value, not pasted in as text:
const order = {{ $node["Get Order"].output }};
return { greeting: "Hi {{ $node["Get Order"].output.customerName }}" };order is a real object, and a quote in the customer's name can't break the script. The same safety applies to Terminal commands and SQL. See Syntax basics → Code, terminal and SQL fields.
Related
- Syntax basics
- Operators, comparisons in If, Switch and While
- Data transformation nodes
- Common patterns
Found something out of date? This page lives in the Flero docs content set.