← define_hierarchical_ruleset operator page · definitions/define_hierarchical_ruleset/condition/conditioning_domain

Conditioning domain 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a ruleset on VD_ITEM conditioned by the value domain VD_FLAG, when VD_FLAG = "X" then A = B, bound with condition Id_1 rule Id_2.

Manual:

define hierarchical ruleset: with no alias "the name of the Value Domain (i.e., condValueDomain) must be used", and the left condition "defines the pre-condition for evaluating the left member Code Item (i.e., it is evaluated only when the leftCondition is true)".

Expected:

one data point, for X: 5 = 5, so bool_var is true and imbalance 0. Y fails the condition and is not compared, so the output all, "all the Data Points produced by the comparison", has no data point for it: the reading of the closed issue #1141.

Finding:

vtlengine's loader ignores the variables and domains of its structure schema, so only the call binds the components.

script.vtl ⇩

define hierarchical ruleset HR_1 (valuedomain condition VD_FLAG rule VD_ITEM) is
    when VD_FLAG = "X" then A = B
end hierarchical ruleset;

DS_r := check_hierarchy(DS_1, HR_1 condition Id_1 rule Id_2 all);

input/DS_1.csv ⇩

Id_1Id_2Me_1
XA5
XB5
YA5
YB4

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {
          "name": "Id_1",
          "type": "String",
          "role": "Identifier",
          "nullable": false
        },
        {
          "name": "Id_2",
          "type": "String",
          "role": "Identifier",
          "nullable": false
        },
        {
          "name": "Me_1",
          "type": "Number",
          "role": "Measure",
          "nullable": true
        }
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2ruleidbool_varimbalanceerrorcodeerrorlevel
XA1true0

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {
          "name": "Id_1",
          "type": "String",
          "role": "Identifier"
        },
        {
          "name": "Id_2",
          "type": "String",
          "role": "Identifier"
        },
        {
          "name": "ruleid",
          "type": "String",
          "role": "Identifier"
        },
        {
          "name": "bool_var",
          "type": "Boolean",
          "role": "Measure"
        },
        {
          "name": "imbalance",
          "type": "Number",
          "role": "Measure"
        },
        {
          "name": "errorcode",
          "type": "String",
          "role": "Measure"
        },
        {
          "name": "errorlevel",
          "type": "Integer",
          "role": "Measure"
        }
      ]
    }
  ]
}

value_domains/VD_FLAG.json ⇩

{
  "name": "VD_FLAG",
  "type": "String",
  "setlist": [
    "X",
    "Y"
  ]
}

value_domains/VD_ITEM.json ⇩

{
  "name": "VD_ITEM",
  "type": "String",
  "setlist": [
    "A",
    "B"
  ]
}