Element <id>¶
Purpose: Define one generated, copied, converted, or scripted field in a product.
Why: Use this key alias to communicate that the generated field identifies the record.
Example¶
1 | |
Decision guide¶
Business value: Communicates record identity explicitly while retaining the complete key-generation contract.
-
Use when
- A field uniquely or stably identifies the current product record.
-
Choose another approach when
- The field is an ordinary measure, label, or transient calculation.
-
Prerequisites
- Choose a generator, source, or script that satisfies the intended identity scope.
-
Alternatives
- Use key for visible fields without identifier semantics. (See:
<key>)
- Use key for visible fields without identifier semantics. (See:
Complete examples¶
Mark record identity explicitly
Use id when a key represents record identity; it retains the full key generation contract.
| id-alias/datamimic.xml | |
|---|---|
1 2 3 4 5 6 | |
Rules and invalid combinations¶
A key requires one value-generation mode.
Attributes: type, source, values, script, generator, constant, pattern, string
Why: A field without a type, source, value pool, script, generator, constant, pattern, or string template cannot produce a value.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
Choose exactly one explicit key generation mode.
Attributes: source, values, script, generator, constant, pattern, string
Why: Combining source, values, script, generator, constant, pattern, or string would make ownership of the field value ambiguous.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
weights requires an inline values pool.
Attributes: weights, values
Why: Each weight biases the corresponding values entry and has no meaning without that pool.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
unique on a key requires an inline values pool.
Attributes: unique, values
Why: Key uniqueness is sampling without replacement from explicitly listed values; generators do not expose a finite pool here.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
unique cannot be combined with weights.
Attributes: unique, weights
Why: Unique sampling is uniform without replacement; weights describe biased draws with replacement.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
Source parsing options require source.
Attributes: source, selector, separator
Why: selector, separator, and source-dependent options only modify a source read.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
A key distribution requires an int or float range.
Attributes: distribution, type, min, max
Why: The key-level distribution shapes a numeric grid and is different from source-row distribution.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
outDateFormat produces a string and rejects a non-string type.
Attributes: outDateFormat, type
Why: Formatting is the final presentation step; downstream expressions no longer receive the raw temporal value.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
Integer granularity must be a whole number.
Attributes: type, granularity
Why: A fractional step cannot produce an integer grid without silent truncation.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
defaultValue requires script.
Attributes: defaultValue, script
Why: The fallback is evaluated only when the scripted value is absent or its condition suppresses generation.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
nullQuota must be between 0 and 1.
Attributes: nullQuota
Why: The value represents a probability: 0 never emits null and 1 always emits null.
| Valid combination | |
|---|---|
1 | |
| Invalid combination | |
|---|---|
1 | |
Allowed parents / Allowed children¶
Allowed parents: else, else-if, generate, if, item, iterate, nestedKey, while
Allowed children:
element
Attributes¶
Show all 29 attributes
condition
Condition for key data generation.
optional; string; Default: null.
constant
Constant value for key data.
optional; string; Default: null.
converter
Converter for key data transformation.
optional; string; Default: null.
database
Database client id when source equals 'database'.
optional; string; Default: null.
defaultValue
Default value for the key.
optional; string; Default: null.
distribution
Sampling distribution / sequence for ranged numeric key.
optional; string; Default: null; Values: uniform, cumulated, step, increment, randomWalk, shuffle, wedge, bitreverse, fibonacci, padovan.
generator
Predefined generators for key data generation.
optional; string; Default: null.
granularity
Step width of numeric grid; defaults 1 for int, 0.1 for float. On int, must be whole.
optional; string; Default: null.
inDateFormat
Input date format for key data.
optional; string; Default: null.
max
Maximum value for numerical generator.
optional; number; Default: null.
maxLength
Maximum length for binary payload generation.
optional; integer; Default: null.
mimeType
Optional MIME signature for binary payload generation.
optional; string; Default: null.
min
Minimum value for numerical generator.
optional; number; Default: null.
minLength
Minimum length for binary payload generation.
optional; integer; Default: null.
name
Name of the key.
required; string.
nullQuota
Null quota for key data generation.
optional; number; Default: null.
outDateFormat
Output date format for key data.
optional; string; Default: null.
pattern
Pattern for key data generation.
optional; string; Default: null.
script
Script for key data generation.
optional; string; Default: null.
selector
Selector for key data generation.
optional; string; Default: null.
separator
Separator for key data.
optional; string; Default: null.
source
Source of data for the key.
optional; string; Default: null.
string
String for the variable data generation.
optional; string; Default: null.
type
Data type of the key.
optional; string; Default: null; Values: string, int, integer, float, bool, binary.
unique
Emit each value at most once (distinct picks from values, no replacement).
optional; boolean; Default: null.
values
Comma-separated list of values for the key.
optional; string; Default: null.
variablePrefix
Prefix before field's name for string in key generation.
optional; string; Default: null.
variableSuffix
Suffix after field's name for string in key generation.
optional; string; Default: null.
weights
Comma-separated relative weights, one per values entry, for weighted random selection.
optional; string; Default: null.