Expressions and code
Transform data with expressions in Duaer
Use expression transformation functions anywhere expressions are supported in Duaer. When you only reshape fields, prepare them in Edit Fields (Set) first.
Where to write a Duaer expression
Switch a parameter from a fixed value to Expression, then write it. Drag a field from INPUT, or type it. Text outside the braces stays; the part inside becomes the computed value.
Do not scatter a long reshape across many node parameters. Use Edit Fields (Set) to add, change, or drop fields, and let later nodes read the prepared data.
Get a field from a webhook body
When a trigger puts the incoming JSON on body, the next node reads the city like this:
{{ $json.body.city }}{{ $json["body"]["city"] }} is the same path. Dots and brackets address the same field.
Write longer JavaScript
When you need several statements, wrap them in an immediately invoked function and return the value you want. Date math uses Luxon’s DateTime.
{{(() => {
const end = DateTime.fromISO("2017-03-13");
const start = DateTime.fromISO("2017-02-13");
return end.diff(start, "months").toObject();
})()}}Use expressions in credential fields
Duaer can evaluate an expression in a credential field. It uses this execution’s data, including values earlier nodes already produced—for example a token from a webhook. Each execution evaluates on its own; a later run does not reuse the previous result.
Long text and long lists
In Duaer, replace() has the same length cap as replaceAll(). Array methods are capped by how large the result would be, not by how many items you started with. If the result would pass the cap, that expression falls back instead of running without a limit.
Common issues
- Invalid JSON output: the value is not valid JSON, or it references a field this input does not have.
- The expression cannot find its data, or a node has not executed yet: run that step first. In a Code node, $("Node name").isExecuted tells you whether an earlier node has run.
- Invalid syntax: an extra dot or a missing bracket. {{ $("If").item.json. }} is invalid because of the trailing dot.
Questions
What does a Duaer expression look like?
In Duaer, write it in double braces, for example {{ $json.body.city }}. Switch the parameter to Expression first. Text outside the braces stays; the braces become the computed value.
What should you check when a Duaer expression cannot find its data?
Usually an earlier node has not run, or the field is missing this time. Run the node the expression names. Do not leave a trailing dot—{{ $("If").item.json. }} is invalid.
What happens when a Duaer expression would build a huge string or list?
replace() and array methods stop at a size cap. Past that cap, Duaer falls back instead of letting the expression grow without a limit.
In this section
Define custom variables in Duaer
Custom variables let you store and reuse values across Duaer workflows.
ExpressionsUse built-in methods and variables in Duaer
Duaer's built-in methods and variables for working with data in expressions. The Code node runs plain JavaScript and native Luxon.
ExamplesExpression examples in Duaer
These Duaer examples run in expression mode. They read the current item, fill a default, format a date, and move a large reshape into Edit Fields (Set).