See it happen
Section titled “See it happen”Edit Fields receives two orders and builds two fields from expressions. Each expression is worked out once per item.
Example run: Orders, 2 items → Edit Fields, ran 2 times, 2 items. name = {{ upper(trim($input.first)) + " " + $input.last }} · size = {{ $input.total > 100 ? "big order" : "small order" }}
| # | name | size |
|---|---|---|
| 0 | ADA Lovelace | big order |
| 1 | GRACE Hopper | small order |
The three things you can read
Section titled “The three things you can read”| Write | Reads | Example |
|---|---|---|
$input |
The item this node is working on | {{ $input.title }}, {{ $input.metadata.description }}, {{ $input.0.name }} |
$('Step name') |
The output of another step, by its label | {{ $('Get Page Metadata').title }} |
$run |
A variable stored earlier in this run by Set Variable | {{ $run.cursor }}, {{ $run.page.next }} |
- Paths use dots, including for list positions:
$input.items.0.nameis thenameof the first entry (counting starts at 0). - Step names must match the node label exactly, spaces and capitals included. Renaming the step breaks the reference.
$('…')and items: a step directly connected to this one gives the matching item; a step further back gives its whole output. See Item linking.- Missing values in
$inputand$('…')become empty text, so a typo doesn’t stop the run. Check Preview from last run under the field. $runis strict: reading a variable that hasn’t been set yet fails the step with an error that names it and lists the variables set so far. Read a variable only in steps that run after the Set Variable node. When a read might come first, the canvas warns you; see reading a variable before it is set.
You rarely type $input yourself: drag a field from the Input panel and the expression is written for you. See Mapping in the UI.
Text around values
Section titled “Text around values”Mix your own words with expressions in any text setting:
Summarize the page at {{ $input.url }}.Title: {{ $input.title }}Operators
Section titled “Operators”Fallbacks: || returns the first value that isn’t empty.
{{ $input.title || "Untitled page" }}Maths: + - * / %, with the usual precedence and parentheses.
{{ 5 + 3 * 2 }} → 11{{ (5 + 3) * 2 }} → 16{{ $input.price * 1.2 }}Joining text: + joins text when either side is text.
{{ $input.first + " " + $input.last }}Comparisons and choices: == != < <= > >=, logic with && || !, and condition ? ifYes : ifNo.
{{ $input.total > 100 ? "big order" : "small order" }}{{ $input.status == "open" && $input.priority == "high" }}Helper functions
Section titled “Helper functions”| Text | Numbers | Lists and general |
|---|---|---|
upper(s) lower(s) trim(s) |
round(n) floor(n) ceil(n) abs(n) |
length(x) |
replace(s, find, with) |
min(a, b, …) max(a, b, …) |
includes(list, value) |
split(s, sep) slice(s, start, end) |
number(x) |
join(list, sep) slice(list, start, end) |
str(x) |
default(value, fallback) |
{{ upper(trim($input.name)) }}{{ join($input.tags, ", ") }}{{ default($input.title, "Untitled") }}{{ length($input.items) > 0 ? "has items" : "empty" }}Expressions are sandboxed: only these functions exist. There are no variables of your own, no method calls like .toUpperCase(), and no access to anything outside the values you reference.
Expression, Edit Fields or Code?
Section titled “Expression, Edit Fields or Code?”- Expression One setting needs a small change: a fallback, a join, a choice. Example {{ $input.title || "Untitled" }}
- Edit Fields Several later steps need the same cleaned-up fields. Example Build name and size once, then read $input.name everywhere.
- Code The logic needs loops, grouping or parsing. Example Count orders per customer.
You’ll notice this when…
Section titled “You’ll notice this when…”The result shows expression text, like $(‘Get Metadata’).title, instead of a value
AWFlow couldn’t work the expression out, so it left the text as it was rather than failing the step. The usual cause is a $('…') name that differs from the node label. Copy the label from the canvas, or drag the field from the Input panel instead.
The value is empty
The path doesn’t exist on this item. Open the previous step’s Output tab and compare: maybe the value is nested ($input.data.title), or the step output one item holding a list ($input.links.0).
The step fails with “Variable … has not been set at this point in the run”
A $run variable is read before the Set Variable step that writes it, for example from a parallel branch. Connect the reading step after the Set Variable step.
An expression with .toUpperCase() comes out as plain text
Methods and outside functions aren’t available, so the expression can’t be worked out and its text is kept as is. Use the helper functions above, such as upper(…), or move the logic to the Code node.