Element <targetConstraints>¶
Purpose: Validate, filter, or amend generated rows before export.
Why: Use it to reject a completed generated row immediately before export.
Example¶
1 | |
Decision guide¶
Business value: Prevents a completed invalid product row from reaching its exporter.
-
Use when
- A rule depends on final generated or mapped output fields.
-
Choose another approach when
- The rule concerns only the original loaded source row.
-
Prerequisites
- Place it after the fields and mappings whose results it checks.
-
Alternatives
- Use sourceConstraints to reject rows before transformation. (See:
<sourceConstraints>) - Use assert for a run-level hard invariant. (See:
<assert>)
- Use sourceConstraints to reject rows before transformation. (See:
Complete examples¶
Filter, transform, and validate source rows in explicit phases
Use source constraints before transformation, mappings in document order, and target constraints only on the completed output row.
| rule-pipeline/data/customers.json | |
|---|---|
1 2 3 4 5 6 | |
| rule-pipeline/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Rules and invalid combinations¶
E005 — Rule Eval Failed
Failed to evaluate {kind} '{expr}' for <{element_tag}>{descriptor}{cause_clause}
Why: A runtime error was classified in this top-level error category.
Resolution: Inspect the nested issue code and descriptor context for the actionable resolution.
Allowed parents / Allowed children¶
Allowed parents: else, else-if, generate, if, iterate, nestedKey, while
Allowed children:
None
Related concepts and use cases¶
- Structured Data and Rule Pipelines — Shows how composite output shapes and the ordered source-filter, mapping, and target-filter pipeline work together without hiding phase boundaries.
Attributes¶
Show all 2 attributes
if
Condition selecting rows to which the constraint applies.
required; string.
require
Requirement expression evaluated for rows selected by if.
required; string.