Duaer

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