← between operator page · comparison/between/ds_sc_sc/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

between(DS_1, 5, 10): every measure value of DS_1 against two scalar limits.

Manual:

Between, Example 1, output verbatim: "The operator returns true if op is greater than or equal to from and lower than or equal to to."

Expected:

bool_var is true for G (6) and false for R (-2).

script.vtl ⇩

DS_r:= between(DS_1, 5, 10);

input/DS_1.csv ⇩

Id_1Id_2Id_3Id_4Me_1
GTotalPercentageTotal6
RTotalPercentageTotal-2

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": "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_4bool_var
GTotalPercentageTotaltrue
RTotalPercentageTotalfalse

expected/DS_r.json ⇩

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