Expression

Map objects with ease using ZEN Expression language

The Expression node serves as a tool for transforming input objects into alternative objects using the Zen Expression Language. When specifying the output properties, each property requires a separate row.

Rows are defined by two fields:

  • Key - qualified name of the output property
  • Value - value expressed through the Zen Expression Language

🚧

Any errors within the Expression node will bring the graph to a halt.

Referencing Previous Results

You can reference the result of a previous expression using the $ symbol followed by the key of the previous expression. This allows you to use the output of one expression as input for another, creating more dynamic and powerful decision logic.

Syntax

To reference a previous expression result, use $.previousKey, where previousKey is the key of the expression you want to reference.

Example

Here's an example of how you can use this feature in an Expression node:

KeyValue
basePrice100
taxRate0.1
taxAmount$.basePrice * $.taxRate
totalPrice$.basePrice + $.taxAmount

In this example:

  1. We define a basePrice of 100.
  2. We set a taxRate of 0.1 (10%).
  3. We calculate the taxAmount by multiplying basePrice by taxRate, referencing the previous results.
  4. Finally, we calculate the totalPrice by adding basePrice and taxAmount, again referencing previous results.

Considerations

  • Expressions are evaluated in the order they appear in the node.
  • You can only reference results from expressions that appear earlier in the list.
  • Circular references are not allowed and will result in an error.

By leveraging this feature, you can create more sophisticated and interconnected decision logic within your Expression nodes, enhancing the overall capability of your decision models.

Modifying Expression Node

Adding row

We can start adding expressions by pressing plus (+ Add Row) button. Editing Key or Value is done by selecting a cell or if cell is already selected, by typing a value.

Reordering rows

Rows can be reordered by dragging the row on it's index (left-side) and dropping it in a desired place.

Deleting row

Deleting a row is done by pressing (-) and then pressing Remove in popover.