taxons. At runtime Kodexa applies those rules to the matching data objects and data attributes in each document.
Use validation rules when the document data must satisfy a business rule. Use conditional formatting when reviewers need a visual cue while reviewing data. Both use the same formula language.
Where Rules Live
Rules can be attached at two levels:
Attribute-level rules are the most common. They bind cleanly to a field in the review UI and can create exceptions against a specific data attribute.
Object-level rules are useful when the business rule is about the row or section rather than a single field. For example, an
invoice object can validate that subtotal + tax_amount matches total_amount.
Attribute-level rule
Object-level rule
Validation Rules
Validation rules are stored in thevalidationRules array on a taxon. Each rule evaluates a formula. If the formula returns truthy, the data passes. If it returns falsy or errors, Kodexa treats the rule as failed.
Rule Fields
Evaluation Flow
- Kodexa finds the taxon for the changed data object or data attribute.
- Disabled rules are skipped.
- If
conditionalistrueandconditionalFormulais present, Kodexa evaluates the condition. - If the condition is truthy, Kodexa evaluates
ruleFormula. - Truthy results pass. Falsy results fail.
- Formula errors are treated as failed validation and marked as evaluation errors so authors can diagnose bad rules.
- Failing rules create or reopen data exceptions. Passing rules close matching open exceptions.
Validation formulas are reactive. When a formula references
{subtotal}, {tax_amount}, or another attribute, Kodexa tracks that dependency and re-evaluates the affected rule when the referenced value changes.Required Fields
Useisblank for required field checks. Missing references resolve to null, so isblank handles missing, null, empty-string, and empty-list values.
Conditional Rules
Setconditional: true when a rule should apply only for some records.
conditional is omitted or false, Kodexa evaluates ruleFormula regardless of conditionalFormula.
Cross-Field Rules
Attach cross-field rules to the field that should receive the exception, or to the group data element when the rule describes the full object.Repeating Groups
When a formula references a child path that has multiple data objects, Kodexa returns an array of values. Math functions such assum, average, min, and max can work across those arrays.
Formula Errors
Formula errors are configuration problems. For example, an unknown function, invalid syntax, or unsupported comparison can cause the rule to fail withevaluationErrored.
Avoid
Use
Conditional Formatting
Conditional formats are stored in theconditionalFormats array on a taxon. Each format has:
Supported Formatter Types
Conditional formatting is attribute-oriented. Add
conditionalFormats to the field taxon whose control should be styled.
Attribute styling
Older examples may use
formula, backgroundColor, textColor, or icon at the top level of a conditional format. The current Kodexa document runtime evaluates condition and returns active { type, properties } records, so new configuration should use the canonical shape shown above.How Conditional Formats Recalculate
Kodexa builds a dependency graph from everycondition. When any referenced value changes, the affected conditional formats are evaluated for that data object.
- A truthy condition activates the format.
- A falsy condition deactivates the format.
- An empty
conditionis skipped. - A condition that errors is treated as inactive.
- Kodexa caches active/inactive state and emits conditional format change events only when the state changes.
Formula Language
Validation rules and conditional formats use Kodexa’s KEXL formula language. The same syntax is used by formula data elements and other Data Definition features.Literals
\", \', \n, and \t, or double the quote character inside the same quote style.
Attribute References
Use curly braces to read values from the current data object or related data objects.externalName mappings, so generated data can use external names without changing the underlying element names.
Operators
Truthy and Falsy Values
Kodexa uses truthiness when deciding whether a validation passes or a conditional format is active.Function Reference
Function names are case-insensitive, but examples should use lower-case names for consistency.Eager and Short-Circuit Evaluation
Function arguments are evaluated before the function runs. That meansif does not protect an invalid branch from being evaluated.
Avoid
Use
Common Formula Patterns
Required value
Optional date ordering
Numeric tolerance
Date window
Selection-like text
Dynamic path
Recommended Authoring Pattern
- Put field-level validation and formatting on the field taxon.
- Put object-level validation on the group data element.
- Use stable
exceptionIdvalues for customer-facing exceptions. - Use
conditional: trueonly when the rule has a real gating condition. - Write formulas with explicit braces around every data reference.
- Prefer
isblank,ifnull,abs,datemath, and date comparison functions over hand-rolled string checks. - Keep conditional formatting visual and non-blocking; use validation rules for business conditions that must be resolved.
Related
Data Definitions Guide
Start with the overall data definition model.
Event-Based Scripting
Use scripts when a rule needs side effects or procedural logic.
Selection Option Formulas
Compute dropdown options dynamically from document context.
Formula Reference
See the broader formula guide and examples.
