Expressions and code
Number transformation methods in Duaer
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.
Methods
- abs() is the absolute value.
- ceil() rounds up. floor() rounds down. round(decimalPlaces) rounds to the nearest number.
- isEven(), isOdd(), and isInteger() test even, odd, and integer.
- isEmpty() and isNotEmpty() test emptiness.
- format(pattern) writes a string in that pattern. toLocaleString() uses the current locale. toString() is a plain string.
- toBoolean() is false for 0 and true for any other number.
- toDateTime() treats the number as a timestamp and returns a DateTime. Match milliseconds or seconds to how you stored it, then format with the date methods.
{{ $json.amount.round(2) }}Questions
How do round, ceil, and floor differ in Duaer?
In a Duaer expression, round() goes to the nearest number and can take a decimal-place count. ceil() rounds up. floor() rounds down. abs() is the absolute value.
How does toBoolean treat a number in Duaer?
In a Duaer expression, 0 becomes false; any other number becomes true.
In this section
Use data transformation methods in Duaer
In a Duaer expression, call a transformation method on a value, such as {{ $json.name.toTitleCase() }}. Methods are grouped by array, boolean, date, number, object, and string.
TransformString transformation methods in Duaer
In a Duaer expression, string methods change case, slice text, test emails and URLs, and encode or decode base64 and URLs.
TransformDate transformation methods in Duaer
In a Duaer expression, $now and $today are Luxon DateTime values. Call toDateTime() on a string or number before format, plus, or setZone.