Skip to main content
Expression nodes transform data using the ZEN expression language. Use them to calculate values, reshape data, and prepare outputs.

Creating an expression node

  1. Drag an Expression node onto the canvas
  2. Connect it to your data flow
  3. Click Edit Expression to open the editor
  4. Define output fields and their expressions

Expression structure

Each expression node produces an output object. You define fields and the expressions that calculate them:

Accessing data

Reference input data using dot notation:
customer.name           // Nested object access
order.items[0].price    // Array indexing

Referencing previous nodes

Use $nodes to access output from any upstream node by its name:
$nodes.CreditCheck.rating       // Output from "CreditCheck" node
$nodes.RiskScore.value          // Output from "RiskScore" node
$nodes["My Node"].field         // Use brackets for names with spaces
See Useful patterns for more examples.

Operators

Arithmetic

price * quantity        // Multiplication
total / count           // Division
base + bonus            // Addition
gross - deductions      // Subtraction
amount % 100            // Modulo (remainder)
2 ^ 10                  // Power (1024)

Comparison

age >= 18               // Greater than or equal
status == "active"      // Equal
tier != "basic"         // Not equal
score < threshold       // Less than

Logical

isActive and hasPermission    // Both must be true
isAdmin or isOwner            // Either can be true
not isBlocked                 // Negation

Ternary (conditional)

score > 70 ? "pass" : "fail"
age >= 18 ? "adult" : age >= 13 ? "teen" : "child"

Null handling

user.nickname ?? user.name ?? "Anonymous"    // First non-null value

Range checks

age in [18..65]         // Inclusive range
score in (0..100)       // Exclusive range
value not in [1..10]    // Outside range

Built-in functions

Math

FunctionExampleResult
abs(n)abs(-5)5
round(n)round(3.7)4
floor(n)floor(3.9)3
ceil(n)ceil(3.1)4
min(arr)min([3, 1, 4])1
max(arr)max([3, 1, 4])4
sum(arr)sum([1, 2, 3])6
avg(arr)avg([10, 20, 30])20

String

FunctionExampleResult
len(s)len("hello")5
upper(s)upper("hello")"HELLO"
lower(s)lower("HELLO")"hello"
trim(s)trim(" hi ")"hi"
contains(s, sub)contains("hello", "ell")true
startsWith(s, prefix)startsWith("hello", "he")true
split(s, delim)split("a,b,c", ",")["a","b","c"]

Array

FunctionExampleResult
len(arr)len([1, 2, 3])3
map(arr, expr)map([1, 2, 3], # * 2)[2, 4, 6]
filter(arr, expr)filter([1, 2, 3, 4], # > 2)[3, 4]
some(arr, expr)some([1, 2, 3], # > 2)true
all(arr, expr)all([1, 2, 3], # > 0)true
flatMap(arr, expr)flatMap([[1,2], [3]], #)[1,2,3]
The # symbol represents each element when iterating over arrays.

Date

FunctionExampleResult
d(str)d("2024-01-15")Date object
d().year()d("2024-01-15").year()2024
d().month()d("2024-01-15").month()1
d().day()d("2024-01-15").day()15
d().add(n, unit)d("2024-01-15").add(7, "d")7 days later
d().diff(d2, unit)d("2024-01-15").diff("2024-01-01", "day")14

Common patterns

Calculate totals

Categorize values

Work with dates