Skip to content

Logic Blocks

A logic block is a reusable validation rule template. Logic blocks created in the Data section act as a library — they can be imported into multiple Contracts without rewriting the same expression.

  1. Navigate to Data > Logic Blocks and click New Logic Block.
  2. Enter a name (e.g. “Total is positive”), optional description, and tags.
  3. Build the expression using the token-based editor.
  4. Click Save.

The expression editor uses a token-based interface where each element is color-coded:

Token Type Color Example
Field reference Purple $total_amount
Operator Gray >, =, and
Number Blue 100, 0.01
String Green "approved"
Function Orange abs(, rsum(
Date Teal Timestamp value

Click tokens to add them to the expression. Remove tokens by clicking the X on each one.

Selecting Processors for Field Suggestions

Section titled “Selecting Processors for Field Suggestions”

When editing a logic block, select one or more processors to see their field names as suggested tokens. This makes it easy to reference the correct $field_name without memorizing field names.

Reference extracted field values using the $ prefix:

$invoice_number
$total_amount
$vendor_name

Field names must exactly match the names defined in the processor.

Logic blocks support arithmetic, comparison, and logical operators, plus built-in functions like abs(), round(), rsum(), and more. See the Expression Syntax reference for the complete list.

To use a logic block in a contract:

  1. Open the Contract editor.
  2. Click Add Logic Block and choose From Template.
  3. Select the logic block from the list.
  4. The expression is copied into the contract. You can then set the severity and optionally modify the expression for this specific contract.

Changes to the original logic block template do not automatically propagate to contracts that have already imported it.