Documentation Index Fetch the complete documentation index at: https://docs.gorules.io/llms.txt
Use this file to discover all available pages before exploring further.
Expression nodes transform data using the ZEN expression language. Use them to calculate values, reshape data, and prepare outputs.
Creating an expression node
Drag an Expression node onto the canvas
Connect it to your data flow
Click Edit Expression to open the editor
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
Function Example Result abs(n)abs(-5)5round(n)round(3.7)4floor(n)floor(3.9)3ceil(n)ceil(3.1)4min(arr)min([3, 1, 4])1max(arr)max([3, 1, 4])4sum(arr)sum([1, 2, 3])6avg(arr)avg([10, 20, 30])20
String
Function Example Result len(s)len("hello")5upper(s)upper("hello")"HELLO"lower(s)lower("HELLO")"hello"trim(s)trim(" hi ")"hi"contains(s, sub)contains("hello", "ell")truestartsWith(s, prefix)startsWith("hello", "he")truesplit(s, delim)split("a,b,c", ",")["a","b","c"]
Array
Function Example Result len(arr)len([1, 2, 3])3map(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)trueall(arr, expr)all([1, 2, 3], # > 0)trueflatMap(arr, expr)flatMap([[1,2], [3]], #)[1,2,3]
The # symbol represents each element when iterating over arrays.
Date
Function Example Result d(str)d("2024-01-15")Date object d().year()d("2024-01-15").year()2024d().month()d("2024-01-15").month()1d().day()d("2024-01-15").day()15d().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