Skip to content
flowon.com

Expression language

Calling logic blocks

Reuse a formula, decision table, decision tree or validation inside an expression with Run Logic Block.

Run Logic Block lets one expression use the result of another logic block. Instead of rebuilding the same discount rule or eligibility check in several places, you build it once as a logic block and call it wherever you need its answer. When the rule changes, you change the block and every expression that calls it follows.

You can call formulas, decision tables, decision trees, validations and validation sets.

  1. In the slot where you need the block’s result, open the picker and choose Run Logic Block from the Logic Block category.
  2. Pick the logic block you want to run.
  3. Bind each of the block’s inputs by name to a value: an input, data from an earlier step, a constant, or another expression.
  4. Choose the output you want the expression to return.

The formula bar shows the block’s name with the bound inputs, for example CalculateDiscount(CustomerTier, totalamount). An input that is not bound yet shows as NULL.

  • One output per call. Each Run Logic Block returns exactly one of the block’s outputs. If you need two outputs, add one Run Logic Block for each, or call the block once from a logic flow step and use its outputs from there.
  • Inputs are bound by name. You choose which value goes into which named input; there is no positional order to remember.
  • Required inputs must be bound. The editor marks the call as a problem until every input the block requires has a value.
  • The output must fit the slot. The picker offers blocks that have an output of the type the slot needs. If you pick a block whose outputs do not fit, it still shows its inputs, and the editor explains why it cannot be used, for example “None of this block’s outputs returns Currency”. The expression is not changed.
  • Nesting works. You can use a Run Logic Block inside any slot, including inside another function, and its inputs keep their expected types.

A decision table named CalculateDiscount returns a DiscountPercent output based on the customer tier and the order total. In a formula that calculates the order’s net amount, you call it inside a multiplication:

totalamount - totalamount * CalculateDiscount(CustomerTier, totalamount)

To use the discount in a validation as well, for example “the discount may not exceed 20% unless a manager approves”, call the same block from the validation. Both stay in step when the discount table changes.