Update rules
Introduction¶
This data loading operation allows a rule to be populated from the data in the dataset.
Note: this operation is only available to ESG licence holders.
The source of the upload will be the dataset/typology of the current task, while the target is the rule selected during the configuration of the upload operation (see Data target mapping (Update rules)).
Note: Currently only 'Calculation Logics' can be selected.
Data verification process¶
Before inserting or updating the elements of a rule, the data processing verifies that the data in the dataset are valid.
Script calculation logics, examples:
Example 1
In this example, a 'Data target mapping: update rules' is configured to update the Script calculation logics with all mapped fields:
Dataset¶
| CODE | DESCRIPTION | SCRIPT | LABEL | ACTIVE | RUN CONDITION | START DATE | END DATE |
|---|---|---|---|---|---|---|---|
| C001 | DESC 001 | TGKML 1.0 | L001 | 1 | ACTIVE = 1 | 15/09/2023 | 20/09/2023 |
There are no errors and the element with code C001 is inserted into the script type calculation logics if it is not already present, otherwise it is updated.
Dataset¶
| CODE | DESCRIPTION | SCRIPT | LABEL | ACTIVE | RUN CONDITION | START DATE | END DATE |
|---|---|---|---|---|---|---|---|
| C002 | DESC 002 | TGKML 1.0 | L002 | 0.5405 | ACTIVE = 1 | 15/09/2023 | 20/09/2023 |
'Active' field error as the valid values are only 0 and 1.
Dataset¶
| CODE | DESCRIPTION | SCRIPT | LABEL | ACTIVE | RUN CONDITION | START DATE | END DATE |
|---|---|---|---|---|---|---|---|
| C003 | DESC 003 | TGKML 1.0 | L003 | 1.000 | ACTIVE = 1 | 15/09/2023 | 20/09/2023 |
| C003 | DESC 003 | TGKML 1.0 | L003 | 1.000 | 15/09/2023 | 20/09/2023 |
Two identical lines, resulting in a duplicate code error.
Dataset¶
| CODE | DESCRIPTION | SCRIPT | LABEL | ACTIVE | RUN CONDITION | START DATE | END DATE |
|---|---|---|---|---|---|---|---|
| C003 | DESC 003 | TGKML 1.0 | L003 | 1 | 15/09/2023 | 20/09/2023 | |
| C003 | DESC 003 | TGKML 1.0 | L004 | 0 | ACTIVE = 1 | 15/09/2023 | 20/09/2023 |
Two elements with the same code, thus resulting in a duplicate code error.
Logical dimensions' calculation logics, examples:
Example 2
In this example, a 'Data target mapping: update rules' is configured to update the Script calculation logics with all mapped fields:
Dataset¶
| SCRIPT OPERAND CODE | LOGICAL DIMENSION | FIELD CODE |
|---|---|---|
| C0S_001 | DL_001 | CC_001 |
| C0S_001 | DL_002 | CC_001 |
There is no error, the element COS_001/DL_001 and the element COS_001/DL_002 are inserted into the script type calculation logics if they are not already present, otherwise they are updated.
Dataset¶
| SCRIPT OPERAND CODE | LOGICAL DIMENSION | CODE FIELD |
|---|---|---|
| C0S_001 | DL_001 | CC_001 |
| C0S_001 | DL_001 | CC_001 |
Two elements with the same code, thus resulting in a duplicate code error.
Note: since the key consists of the fields 'script operand code' and 'logical dimension', it is currently not possible to update the 'logical dimension' field of an existing element via the 'Update rule' data processing.
Managing mandatory and non-mandatory fields¶
The Update rules operation takes into account all mapped fields. If a mapped field is mandatory, and no value is present in the dataset, the system reports an error both when the data processing inserts values and when a pre-existing element is updated. However, if the mapped field is not mandatory and the value does not exist for a certain row of the dataset, the system does not insert any value for new elements, whereas it overwrites the pre-existing value, thus emptying the field, when updating an element present in the rule.
Example 2
In this example, a 'Data target mapping: update rules' is configured with all fields mapped, assuming that element C001 exists on the Script type calculation logic and has all fields filled in.
-
Dataset¶
| CODE | DESCRIPTION | SCRIPT | LABEL | ACTIVE | RUN CONDITION | START DATE | END DATE |
|---|---|---|---|---|---|---|---|
| C001 | DESC 001 | TGKML 1.0 | L001 | 1.000 |
There are no errors, all fields of element C001 are updated. In particular, the 'Start Date' and 'End Date' fields are cleared, overwriting the previous value.
Execution conditions¶
Personal data option¶
The option 'Personal Data Protection' is currently not supported in the calculation logics, so it must not be selected on the dataset fields. If selected, data processing fails.
Encoded option¶
The “Encoded” option must be selected on the field mapped with the description. If this condition is not met, the data processing will fail.