← period_indicator operator page · time/period_indicator/comp/manual_ex_2

Manual example 2 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

period_indicator(Id_3) inside filter, compared with cast("A", duration): the annual data points are kept.

Manual:

Period indicator, Example 2, output verbatim: "The period indicator is the part of the time_period value which denotes the duration of the time period (e.g. day, week, month...)."

Expected:

2010 has the indicator A and 2013Q1 has Q, so the data point of 2010 is kept, with all its components.

script.vtl ⇩

DS_r := DS_1 [ filter period_indicator ( Id_3 ) = cast("A", duration) ];

input/DS_1.csv ⇩

Id_1Id_2Id_3Me_1
A1201010
A12013Q150

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": "Time_Period", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Id_2Id_3Me_1
A1201010

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": "Time_Period", "role": "Identifier"},
        {"name": "Me_1", "type": "Integer", "role": "Measure"}
      ]
    }
  ]
}