← isnull operator page · comparison/isnull/comp/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

isnull(Me_1) inside calc, where the new measure Me_2 takes the result.

Manual:

Is null, Example 2, output verbatim: "The operator returns true if the value of the operand is null, false otherwise."

Expected:

Me_2 is true for S and W, whose Me_1 is null, and false for B, G, M and F; Me_1 is kept.

script.vtl ⇩

DS_r := DS_1[ calc Me_2 := isnull(Me_1) ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
2012BTotalTotal11094850
2012GTotalTotal11123034
2012STotalTotal
2012MTotalTotal46818219
2012FTotalTotal5401267
2012WTotalTotal

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4Me_1Me_2
2012BTotalTotal11094850false
2012GTotalTotal11123034false
2012STotalTotaltrue
2012MTotalTotal46818219false
2012FTotalTotal5401267false
2012WTotalTotaltrue

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
        {"name": "Id_2", "type": "String", "role": "Identifier"},
        {"name": "Id_3", "type": "String", "role": "Identifier"},
        {"name": "Id_4", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"},
        {"name": "Me_2", "type": "Boolean", "role": "Measure"}
      ]
    }
  ]
}