# Rule Engine

The **Rule Engine** is a configurable, priority-ordered decision engine shared across the DEXPRO apps. It lets you express business decisions as rules instead of code — for example choosing the next process step, checking plausibility, or assigning an account in SQUEEZE, and deciding stage transitions or assignees in Advanced Workflow.

## Purpose and business value

Many document-processing decisions differ by customer, vendor, amount, or document type. The Rule Engine puts those decisions in the hands of configurators: rules are evaluated in priority order, and the first matching rule determines the outcome. This keeps behavior transparent and adjustable without a development change.

## Concepts

### Rule Set

A **Rule Set** is scoped to exactly one **primary table** and can reference up to **50 related tables**. It groups everything the engine needs to evaluate one kind of decision.

### Rule Group

A **Rule Group** organizes rules within a rule set and orders them so they are evaluated in a defined sequence.

### Rule

A **Rule** defines the actual condition to match. It supports:

- **AND / OR condition groups** — combine several conditions with a logical connector.
- **Line match type** — **Any** (a match on any record is enough) or **All Records** (every record must match).
- **Validity dates** — a Valid From / Valid To window.
- **Active** flag — enable or disable the rule.

### Rule Condition

A **Rule Condition** compares a field against a value using a comparison operator. It can compare to a single value or to a reusable value set.

### Value Set

A **Value Set** is a reusable list of values used by the **In Set** operator, so the same list can be referenced from many conditions.

### Rule Validity Period

A **Rule Validity Period** restricts when a rule applies using weekday, time-of-day, and date windows.

## Comparison operators

- Equal
- Not Equal
- Greater Than / Greater Than Or Equal
- Less Than / Less Than Or Equal
- Contains
- Begins With
- Ends With
- Between
- In Set
- RegEx

## Testing rules

An interactive **Rule Test** page lets you evaluate a rule set against sample data and see which rule matches, so you can verify your configuration before it goes live.

{add screenshot of Rule Test here}

## Validation messages

- **"Only one primary table allowed per rule set"** — a rule set can have exactly one primary table.
- **"Maximum allowed: 50 tables"** — you cannot add more than 50 related tables to a rule set.
- **"Valid To must not be earlier than Valid From"** — the validity window must be in the correct order.
- **Operator-not-allowed-for-field-type** — a comparison operator that does not apply to the selected field's data type is rejected (for example a text-only operator on a numeric field).

## Related features

- Rule Sets
- Rule Card