Duaer

Expressions and code

Data transformation methods by type

Duaer expressions call transformation methods on a value, such as {{ $json.name.toTitleCase() }}. The methods are grouped by array, boolean, date, number, object, and string. The Code node does not have these extensions.

How to call a method in a Duaer expression

Set the parameter to Expression, then put a dot and the method after the field or literal. The method changes the expression result. It does not rewrite the original item stored on the previous node unless you write the result into a new field.

When the work is only transformation, put the expressions in Edit Fields (Set). In the Code node, use JavaScript or Luxon’s own methods.

{{ $json.email.extractEmail() }}

The six groups

Questions

Where do you write a Duaer transformation method?

A Duaer transformation method is written after the value, for example {{ $json.email.extractEmail() }}. The parameter must be in Expression mode. These extensions are not in the Code node.

How are Duaer transformation methods grouped?

Duaer transformation methods are grouped as arrays, booleans, dates, numbers, objects, and strings. Date math needs a Luxon DateTime. $now is already a DateTime. A string uses toDateTime().

In this section

Variables

Define reusable variables in Duaer

Duaer variables store a value for more than one digital organization. Expressions and the Code node read them as $vars.key. Every variable is a string, and a run only reads it.

Expressions

Write expressions in Duaer

A Duaer expression sits inside {{ }} and reads the current item, earlier nodes, and variables from a node parameter. When you are only reshaping fields, prepare them in an Edit Fields (Set) node first.

Expressions

Built-in methods and variables in Duaer expressions

Duaer expressions provide variables for reading data and methods you call on a value. The Code node runs plain JavaScript and native Luxon. A method that is a Duaer extension may be missing there, or take different arguments.

Expressions

Convenience methods in Duaer expressions

Duaer expressions use $json for the current item, $("Node name") for an earlier node, and $now and $if() for time and conditions. These names are available in expression mode on a parameter.

Expressions

Variables for HTTP node pagination

The Duaer HTTP Request node provides $pageCount, $request, and $response in pagination expressions. Those three names work only in that node. Other nodes cannot read them.

Transform

Array transformation methods

In a Duaer expression, call an array method on the array, such as {{ $json.ids.unique() }}. average, max, and min throw if any element is not a number.

Transform

Boolean transformation methods

In a Duaer expression, a boolean can be tested for empty and converted to a number or a string. true becomes 1 as a number. false becomes 0.

Transform

Date transformation methods

In a Duaer expression, $now and $today are Luxon DateTime values. Call toDateTime() on a string or number before format, plus, or setZone.

Transform

Number transformation methods

In a Duaer expression, number methods round, test even or odd, and convert to a boolean, a string, or a DateTime. round goes to the nearest number. ceil goes up. floor goes down.

Transform

Object transformation methods

In a Duaer expression, object methods test fields, drop fields, merge objects, and encode an object as a query string. keys() and values() return the field names and the values.

Transform

String transformation methods

In a Duaer expression, string methods change case, slice text, test emails and URLs, and encode or decode base64 and URLs. Call the method on the string.

Query

Query JSON with JMESPath

Duaer queries JSON with $jmespath(object, "query"). Expressions and the JavaScript Code node can call it. The Python Code node does not have this function.

Dates

Use Luxon for dates in expressions

Dates in a Duaer expression are Luxon DateTime values. $now and $today are DateTime values already. The Code node uses native Luxon. format() and plus(amount, unit) do not carry over unchanged.

Examples

Duaer expression examples

These examples run in Duaer expression mode. They read the current item, fill a default, format a date, and move a large reshape into Edit Fields (Set).

Examples

Methods and variables reference

These are the names used most often in a Duaer expression. The current item is $json, an earlier node is $("Node name"), variables are $vars, and transformation methods are grouped by data type.