← not operator page · boolean/not/comp/true_false_and_null_values

True false and null values 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1[calc Me_2 := not Me_1]: a component Me_1 that is true, false and null.

Manual:

Logical negation: "not false gives true", "not true gives false" and "not null gives null"; the page's sentence "returns true if op is false, otherwise true" has a typo ("otherwise true" would make not true true) and ignores null, and the listed rows govern.

Expected:

Me_2 is false, true and null: not true is false, not false is true and not null is null.

script.vtl ⇩

DS_r := DS_1[calc Me_2 := not Me_1];

input/DS_1.csv ⇩

Id_1Me_1
1true
2false
3

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1Me_2
1truefalse
2falsetrue
3

expected/DS_r.json ⇩

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