← sub operator page · clause/sub/multi_id/manual_ex_1

Manual example 1 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

sub Id_1 = 1, Id_2 = "A": two of the three identifiers fixed.

Manual:

Subspace, Example 1, output verbatim: "It maintains the Data Points of VDS for which identifier = value (for all the specified identifier) and eliminates all the Data Points for which identifier <> value (even for only one specified identifier)", then "It projects out (“drops”, in VTL terms) all the identifier (s)".

Expected:

The two data points with Id_1 = 1 and Id_2 = A, without these two identifiers: Id_3, Me_1 and At_1 = XX, 20, F and YY, 1, F.

script.vtl ⇩

DS_r := DS_1 [ sub Id_1 = 1, Id_2 = "A" ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1At_1
1AXX20F
1AYY1F
1BXX4E
1BYY9F
2AXX7F
2AYY5E
2BXX12F
2BYY15F

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_3Me_1At_1
XX20F
YY1F

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_3", "type": "String", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"},
        {"name": "At_1", "type": "String", "role": "Attribute"}
      ]
    }
  ]
}