Expression Syntax
Expression Syntax using ZEN Expression Language for writing conditions, formulas, and logic in Decision Nodes, Switch Nodes, Expression Nodes, and Decision Tables. It provides a shared understanding between business analysts and developers, enabling you to create dynamic decision logic without writing full code.
Overview
Expression Syntax supports a wide range of operations including:
- Mathematical calculations - Arithmetic operations, functions like abs, floor, ceil
- String manipulation - Concatenation, case conversion, pattern matching
- Boolean logic - Conditional operators, comparisons, logical operations
- Date and time operations - Date manipulation, formatting, and calculations
- Array operations - Filtering, mapping, aggregation functions
- Context access - Reference input data and variables from your workflow
Language Guides
Explore the detailed documentation for each data type and operation category:
String
Learn about string operations including concatenation, case conversion, pattern matching, and extraction. Functions include len(), upper(), lower(), contains(), matches(), and more.
Number
Discover numeric operations and mathematical functions. Includes arithmetic operators, rounding functions (floor(), ceil(), round()), absolute values, and random number generation.
Boolean
Master logical operations and conditional expressions. Learn about logical operators (and, or, not), comparison operators, and the ternary operator for inline conditionals.
Date and Time
Work with dates and times including parsing, formatting, date arithmetic, and extracting components like year, month, day, and weekday.
Array
Manipulate collections with array functions. Learn about aggregation (sum(), max(), min()), filtering, mapping, and other array operations.
Context
Understand how to access and reference input data, variables, and context from your decision model.
Operators
Arithmetic
| Operator | Description | Example | Result |
|---|---|---|---|
+ |
Addition | 100 + 100 |
200 |
- |
Subtraction | 10 - 3 |
7 |
* |
Multiplication | 10 * 5 |
50 |
/ |
Division | 20 / 4 |
5 |
^ |
Power | 10 ^ 2 |
100 |
% |
Modulo | 10 % 3 |
1 |
Comparison
| Operator | Description | Example | Result |
|---|---|---|---|
== |
Equal | 5 == 5 |
true |
!= |
Not equal | 5 != 3 |
true |
< |
Less than | 3 < 5 |
true |
> |
Greater than | 5 > 3 |
true |
<= |
Less than or equal | 5 <= 5 |
true |
>= |
Greater than or equal | 5 >= 3 |
true |
Logical
| Operator | Description | Example | Result |
|---|---|---|---|
and |
Logical AND | true and false |
false |
or |
Logical OR | true or false |
true |
not |
Negation | not(true) |
false |
Note: Use
and,or, andnot— not&&,||, or!.
Ternary
Use the ternary operator for inline conditional expressions:
product.price > 100 ? 'premium' : 'value'Null Coalescing
The ?? operator returns the right-hand value when the left-hand value is null. It can be chained:
customer.nickname ?? customer.firstName ?? 'Guest'Membership
1 in [1, 2, 3] // true
5 not in [1, 2, 3] // trueRange
Shorthand for comparing values within a range using inclusive [] or exclusive () brackets:
| Expression | Equivalent |
|---|---|
x in [a..b] |
x >= a and x <= b |
x in (a..b) |
x > a and x < b |
x in [a..b) |
x >= a and x < b |
x in (a..b] |
x > a and x <= b |
5 in [1..10] // true
5 in (5..10] // false (exclusive start)Data Access
Dot notation
customer.address.city // Access nested propertiesArray indexing
items[0] // First element
items[1] // Second elementBracket notation
user["name"] // Equivalent to user.nameTemplate strings
Use backticks with ${} for string interpolation:
`Hello ${customer.firstName}` // "Hello John"String slicing
"hello"[1:3] // "el"Decision Table Specifics
When writing expressions inside Decision Table input columns:
$represents the tested value for the current column- Expressions in input columns use unary mode, where shorthand is supported:
| Shorthand | Equivalent Expression |
|---|---|
> 100 |
$ > 100 |
[1..10] |
$ in [1..10] |
"value1", "value2" |
$ == "value1" or $ == "value2" |
not in [1, 2, 3] |
$ not in [1, 2, 3] |
Quick Examples
Mathematical Operations:
100 + 100 // 200
10 * 5 // 50
10 ^ 2 // 100
input.count * 500 // Multiply input valueLogic & Comparisons:
input.age >= 65 and input.isCitizen == true
1 in [1, 2, 3] // true
5 in (5..10] // false (exclusive range)
customer.nickname ?? 'Guest' // null coalescingString Operations:
"hello" + " " + "world" // "hello world"
len("world") // 5
upper('john') // "JOHN"
contains("hello world", "hello") // true
`Welcome ${user.name}` // template stringArray Functions:
sum([1, 2, 3]) // 6
max([1, 2, 3]) // 3
filter([100, 200, 400], # >= 200) // [200, 400]Date Functions:
d("2025-06-01").weekday() // 0 (Sunday)
d("now").format("YYYY-MM-DD")
d("2025-06-01").add(7, "day")
duration("1h 30m") // 5400Where Expression Syntax is Used
Expression Syntax is used in the following Nodes:
- Decision Node - Define rules and conditions in decision tables
- Switch Node - Create conditional branches with If/Else logic
- Expression Node - Evaluate formulas and return single values
- Decision Table Node - Write input/output rules and conditions
Tip: Expression Syntax is designed to be readable and maintainable. Start with simple expressions and gradually only build more complex logic if needed.