← check_hierarchy operator page · validation/check_hierarchy/condition/conditioning_variable_named
pandas ✅ · DuckDB ✅
HR_2 on Id_2 conditioned by the variable Id_1, R1 : when Id_1 = 2 then A = B, called with condition Id_1 and the default non_null, dataset and invalid.
Check hierarchy: on Variables, condComp "can be specified all the same if it is desired to show explicitly in the invocation which are the involved Components"; the leftCondition "defines the pre-condition for evaluating the left member Code Item (i.e., it is evaluated only when the leftCondition is true)" (define hierarchical ruleset).
(2, A, R1) only, 7 = 4 being false, with Me_1 7 and imbalance 3: for Id_1 1 the rule is not evaluated, though 5 = 2 would be false, and invalid leaves such a rule out whatever it returns. imbalance, left minus right, is a Number like Me_1, and the null errorlevel Integer, the manual's default without errorlevel_vd (#1256).
define hierarchical ruleset HR_2 ( variable condition Id_1 rule Id_2 ) is
R1 : when Id_1 = 2 then A = B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_2 condition Id_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 5 |
| 1 | B | 2 |
| 2 | A | 7 |
| 2 | B | 4 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Number", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 2 | A | R1 | 7 | 3 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "ruleid", "type": "String", "role": "Identifier"},
{"name": "Me_1", "type": "Number", "role": "Measure"},
{"name": "imbalance", "type": "Number", "role": "Measure"},
{"name": "errorcode", "type": "String", "role": "Measure"},
{"name": "errorlevel", "type": "Integer", "role": "Measure"}
]
}
]
}