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.
Creating a Logic Block
Section titled “Creating a Logic Block”- Navigate to Data > Logic Blocks and click New Logic Block.
- Enter a name (e.g. “Total is positive”), optional description, and tags.
- Build the expression using the token-based editor.
- Click Save.
Expression Builder
Section titled “Expression Builder”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.
Field References
Section titled “Field References”Reference extracted field values using the $ prefix:
$invoice_number$total_amount$vendor_nameField names must exactly match the names defined in the processor.
Operators and Functions
Section titled “Operators and Functions”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.
Using in Contracts
Section titled “Using in Contracts”To use a logic block in a contract:
- Open the Contract editor.
- Click Add Logic Block and choose From Template.
- Select the logic block from the list.
- 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.