Element <if>¶
Purpose: Evaluate a condition and execute this branch when it is true.
Why: Use it as the first conditional branch for child statements that run only when its condition is true.
Example¶
1 | |
Decision guide¶
Business value: Keeps an alternative business path explicit instead of hiding it inside scripts.
-
Use when
- Several child statements share one business condition.
-
Choose another approach when
- Only one field needs a simple expression or assignment.
-
Prerequisites
- Place it inside condition and provide an evaluable condition.
-
Alternatives
Complete examples¶
Assemble nested objects, conditional lists, arrays, and branches
Use this shape when one deterministic product combines nested records, heterogeneous list entries, literal arrays, and mutually exclusive fields.
| structured-profile/datamimic.xml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
Rules and invalid combinations¶
I506 — Condition Eval Failed
Failed to evaluate condition '{condition}' for {element_label}: {error}
Why: The system failed to evaluate condition '{condition}' for {element_label}: {error}.
Resolution: Fix the expression or script and retry.
I507 — Condition Not Boolean
Condition '{condition}' for {element_label} evaluated to a non-boolean value (not a valid boolean value): {value}
Why: A condition evaluated to a non-boolean value in the condition configuration.
Resolution: Ensure the expression evaluates to true or false.
Allowed parents / Allowed children¶
Allowed parents: condition, else, else-if, if, while
Allowed children:
All registered DSL elements.
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 1 attributes
condition
Condition to evaluate.
required; string.