Element <array>¶
Purpose: Generate a repeated array from a literal value set or scripted source.
Why: Use it for a homogeneous scalar collection produced from literals, a script, or a typed count.
Example¶
1 | |
Decision guide¶
Business value: Expresses a homogeneous scalar collection as one field in the product contract.
-
Use when
- All array entries share one scalar type or come from one repeated expression.
-
Choose another approach when
- Entries have different structures or contain nested business records.
-
Prerequisites
- Select a literal, scripted, or counted array strategy.
-
Alternatives
- Use list for heterogeneous or conditional entries. (See:
<list>) - Use nestedKey for repeated structured records. (See:
<nestedKey>)
- Use list for heterogeneous or conditional entries. (See:
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¶
script cannot be combined with type or count.
Attributes: script, type, count
Why: The script returns the complete array, so a separate element type or repetition count is ambiguous.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
A non-script array requires both type and count.
Attributes: type, count, script
Why: DataMimic needs the scalar type and the number of repeated child values when no script owns the array.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
type='literal' rejects script and count.
Attributes: type, script, count
Why: A literal array obtains its stable contents from ordered
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
I611 β Parser Array Subelements Not Allowed
Element
Why: An error occurred during descriptor parsing.
Resolution: Review the configuration and retry.
I612 β Parser Array Literal Empty
Literal array '{name}' must define at least one
Why: The configuration violates the requirement that Literal array '{name}' must define at least one
Resolution: Provide a non-empty configuration and retry.
I613 β Parser Array Value Invalid
Failed while parsing attributes of element <{child_tag}> inside
Why: The system failed while parsing attributes of element <{child_tag}> inside
Resolution: Correct the configuration to a valid value or configuration.
I804 β Task Array Script Element Type
Failed while evaluate script '{script}' of
Why: The system failed while evaluate script '{script}' of
Resolution: Review the configuration and retry.
I805 β Task Array Script Mixed Types
Failed while evaluate script '{script}' of
Why: The system failed while evaluate script '{script}' of
Resolution: Review the configuration and retry.
I806 β Task Array Script Not List
expect datatype list of evaluated script '{script}' of
Why: A value expected to be a list was not a list in the task configuration.
Resolution: Provide a list value for the script.
Allowed parents / Allowed children¶
Allowed parents: else, else-if, generate, if, item, iterate, nestedKey, while
Allowed children:
value
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 4 attributes
count
Number of elements in the array.
optional; integer; Default: null.
name
Name of the array.
required; string.
script
Script for generating array elements.
optional; string; Default: null.
type
Data type of the array.
optional; string; Default: null; Values: string, int, float, bool, literal.