Element <mapping>¶
Purpose: Conditionally add or overwrite product fields during the ordered mapping phase.
Why: Use it to add or overwrite fields conditionally during the ordered transformation phase.
Example¶
1 | |
Decision guide¶
Business value: Keeps ordered source-to-target transformations explicit without hiding them in one large script.
-
Use when
- A source row conditionally adds or overwrites one or more product fields.
-
Choose another approach when
- Only validation is required or a field's value is already clear as a key script.
-
Prerequisites
- Place mappings in the required evaluation order after source constraints.
-
Alternatives
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 to evaluate.
required; string.
set
Expression or Python assignment applied when the condition is true.
required; string.