← and operator page · boolean/and/comp_sc/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

DS_1 [ calc Me_2 := Me_1 and true ]: a new measure from a component and the boolean scalar true.

Manual:

Logical conjunction, Example 2, output verbatim: "The and operator returns true if both operands are true, otherwise false."

Expected:

the page's six data points: Me_2 equals Me_1 on each one, as and true leaves the other operand as it is.

script.vtl ⇩

DS_r := DS_1 [ calc Me_2:= Me_1 and true ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
M15B2013True
M64B2013False
M65B2013True
F15U2013False
F64U2013False
F65U2013True

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Id_2Id_3Id_4Me_1Me_2
M15B2013truetrue
M64B2013falsefalse
M65B2013truetrue
F15U2013falsefalse
F64U2013falsefalse
F65U2013truetrue

expected/DS_r.json ⇩

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