Skip to content

Expression Syntax Reference

Logic block expressions define validation rules that evaluate against extracted document data. This page covers all supported syntax.

Reference extracted field values using the $ prefix followed by the field name:

$invoice_number
$total_amount
$vendor_name

Field names must exactly match the names defined in the Processor. Use snake_case naming.

For fields inside a group, use the same $field_name syntax — the expression context determines which group instance is being evaluated.

String values for comparison:

$vendor_name = "Acme Corp"
$status != ""

Numeric literals (integer or decimal):

$total_amount > 0
abs($expected - $actual) < 0.01
$tax_rate = 8.25

Dates are represented as Unix timestamps in milliseconds:

$invoice_date > 1719806400000

The value 1719806400000 represents July 1, 2024. The expression builder provides a date picker that converts selected dates to timestamps automatically.

Operator Description Example
+ Addition $subtotal + $tax
- Subtraction $expected - $actual
* Multiplication $unit_price * $quantity
/ Division $total / $count
^ Exponentiation $base ^ 2
Operator Description Example
= Equal to $status = "approved"
!= Not equal to $vendor_name != ""
> Greater than $total_amount > 0
< Less than $discount < 100
>= Greater than or equal $quantity >= 1
<= Less than or equal $tax_rate <= 10
Operator Description Example
and Both conditions must be true $total > 0 and $date > 1719806400000
or At least one condition must be true $status = "approved" or $status = "pending"
not Negates the following condition not $is_void

Use parentheses to control evaluation order:

($subtotal + $tax) = $total_amount
($status = "approved" or $status = "pending") and $total > 0
Function Arguments Returns Description
abs(number) 1 number number Absolute value
ceil(number) 1 number number Round up to nearest integer
floor(number) 1 number number Round down to nearest integer
round(number) 1 number number Round to nearest integer
sqrt(number) 1 number number Square root
Function Arguments Returns Description
max(number, number) 2 numbers number Larger of two values
min(number, number) 2 numbers number Smaller of two values
fuzzyEquals(string, string) 2 strings boolean Fuzzy string comparison — returns true if strings are approximately equal
Function Arguments Returns Description
if(condition, true_value, false_value) condition + 2 values any Returns true_value if condition is truthy, otherwise false_value
Function Arguments Returns Description
lookup(value, constant_id, lookup_col, return_col) 4 strings string or number Finds value in lookup_col of the specified Constant, returns the corresponding return_col value. Falls back to fuzzy matching if no exact match.
Function Arguments Returns Description
today() none number Current date/time as Unix timestamp (milliseconds)
Function Arguments Returns Description
sum(number, number) 2 numbers number Sum of two values
rsum(group_field) 1 group field name number Sum of a field across all instances of a repeating group
ravg(group_field) 1 group field name number Average of a field across all instances of a repeating group
rcount(group_field) 1 group field name number Count of instances in a repeating group

The rsum, ravg, and rcount functions are designed for field groups. They aggregate across all instances of a repeating group within a single document.

$total_amount > 0

Ensures the total amount is positive.

$vendor_name != "" and $invoice_number != ""

Ensures both vendor name and invoice number are populated.

abs($expected - $actual) < 0.01

Checks that two values are within a penny of each other.

rsum($line_item_amount) = $total_amount

Verifies that the sum of all line item amounts equals the document total.

$invoice_date > 1719806400000 and $invoice_date < 1735689600000

Checks that the invoice date falls between July 1, 2024 and January 1, 2025.

($subtotal + $tax) = $total_amount and $total_amount > 0

Validates that subtotal plus tax equals the total, and the total is positive.

lookup($procedure_code, "rate_schedule", "procedure", "rate") >= $billed_amount

Looks up the expected rate for a procedure code from the “rate_schedule” constant and checks that the billed amount does not exceed it.

$invoice_date > today() - 31536000000

Checks that the invoice date is within the last year (365 days in milliseconds).

if($is_taxable, $subtotal * 1.1, $subtotal) = $total_amount

Applies a 10% tax if the item is taxable, then checks the result matches the total.