Enrichment from another dataset
Function¶
The Enrichment from another dataset operation allows one or more fields in a target dataset to be populated using values from a source dataset or using calculated values. In particular, it modifies the value of existing fields in the target dataset.
At the end of this operation, the system checks whether several identical rows have been created, e.g. as a result of checking several conditions on the same row. If so, it returns an error. Matching fields are mandatory because you must specify at least one condition column and one attribute column to enable the update.
Note: If both source and target have a null value for a column used as a condition, the system treats them as two different rows. Therefore, the condition is not satisfied.
At the end of the operation, a check is carried out to ensure that no rows have been duplicated during the enrichment (e.g. due to more than one condition being checked for the same row).
Note: On the operation page, the Enrich only null values flag has two options:
- selected: if the target dataset field set as an attribute in the matching fields is empty then it performs the enrichment, otherwise it does nothing.
- not selected: the target dataset field set as an attribute in the matching fields is always updated with the value of the source dataset
Advanced Tab¶
The source scenario /period fields allow you to define a scenario/period from which to read data for the given source dataset. It is possible to specify a value using the AW parameters or through the same syntax used in the definition of cell fields.
When the field is left blank, the DTP launch scenario/period is taken into account; however, in the case of a non-existent or inactive scenario/period, the DTP will go ahead without running the operation, reporting the failed execution in the audit.
Note: the advanced tab is only visible for physical or virtual datasets.
Example
This example shows the execution of an enrichment operation from another dataset.
Target Dataset¶
| CONTRACT | CUSTOMER | AMOUNT | COUNTRY | RATE |
|---|---|---|---|---|
| C2 | Madison White | 5000 | Rome | |
| C1 | Joe Black | 10000 | New York |
Source Dataset¶
| COUNTRY | RATE |
|---|---|
| Rome | 1.7 |
| New York | 1.5 |
The goal is to update the RATE field of the target dataset with the value of the RATE field of the source dataset. In matching fields, the field to be used as a condition and the field to be used as an attribute are specified.
Matching fields¶
| Target field | Source field | Relationship type |
|---|---|---|
| COUNTRY | COUNTRY | Condition |
| RATE | RATE | Attribute |
After performing the Enrichment from another dataset operation , the resulting dataset will be as follows:
Target Dataset¶
| CONTRACT | CUSTOMER | AMOUNT | COUNTRY | RATE |
|---|---|---|---|---|
| C2 | Madison White | 5000 | Rome | 1.7 |
| C1 | Joe Black | 10000 | New York | 1.5 |
Example
Target Dataset¶
| CONTRACT | CUSTOMER | AMOUNT | COUNTRY | RATE |
|---|---|---|---|---|
| C2 | Madison White | 5000 | Rome | |
| C1 | Joe Black | 10000 | New York |
Source Dataset¶
| COUNTRY | RATE |
|---|---|
| Rome | 1.7 |
| Rome | 2.0 |
| New York | 1.5 |
The goal is to update the RATE field of the target dataset with the value of the RATE field of the source dataset. In matching fields, the field to be used as a condition and the field to be used as an attribute are specified.
Matching fields¶
| Target field | Source field | Relationship type |
|---|---|---|
| COUNTRY | COUNTRY | Condition |
| RATE | RATE | Attribute |
Data processing fails because there are two rows in the source dataset that meet the condition COUNTRY = Rome and the system does not know which RATE to use to update the row in the target dataset.