Expressions and code
Expression 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).
Read one field from a webhook body
When the trigger puts the incoming JSON on body, the next node reads the city like this:
{{ $json.body.city }}Supply a default when the value is missing
$ifEmpty replaces undefined, null, an empty string, an empty array, and an empty object with the second argument.
{{ $ifEmpty($json.body.city, "unknown") }}Format the current time
{{ $now.setZone("Asia/Shanghai").toFormat("yyyy-MM-dd HH:mm") }}Prepare many fields in one place
When several fields change together, add an Edit Fields (Set) node and put one expression on each new field. Later nodes read the prepared $json instead of repeating the same path.
Questions
How do you read a city from a webhook body in Duaer?
In Duaer, in the next node, write {{ $json.body.city }}. When the city may be missing, use {{ $ifEmpty($json.body.city, "unknown") }}.
Where should Duaer expressions go when many fields change?
In a Duaer workflow, add an Edit Fields (Set) node and put one expression on each new field. Later nodes read the prepared $json—do not repeat the same path in every parameter.
In this section
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.
ExpressionsUse convenience methods in Duaer expressions
In a Duaer expression, use $json for the current item, $("Node name") for an earlier node, and $now and $if() for time and conditions.
DatesWork with dates using Luxon in Duaer
Dates in a Duaer expression are Luxon DateTime values. $now and $today already are. The Code node uses native Luxon—format() and plus(amount, unit) do not carry over unchanged.