← nvl operator page · conditional/nvl/ds_ds/partly_different_identifiers

Partly different identifiers 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

nvl ( DS_1, DS_2 ) on two data sets with the same components and partly different identifiers: id 1 is only in DS_1 and id 4 only in DS_2.

Manual:

Nvl: "The operator has the typical behaviour of the operators applicable on two scalar values or Data Sets or Data Set Components", where "Data Points that are not coupled are left out" (Typical behaviours).

Expected:

only ids 2 and 3 are coupled: id 2 is null in DS_1 and takes DS_2's 200; id 3 keeps its 30, and DS_2's 300 is not used.

script.vtl ⇩

DS_r := nvl ( DS_1, DS_2 );

input/DS_1.csv ⇩

Id_1Me_1
110
2
330

input/DS_1.json ⇩

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

input/DS_2.csv ⇩

Id_1Me_1
2200
3300
4400

input/DS_2.json ⇩

{
  "datasets": [
    {
      "name": "DS_2",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1
2200
330

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}