← calc operator page · clause/calc/viral_attribute/constant_viral_attribute

Constant viral attribute 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

calc viral attribute At_1 := "EP": the calculation of Manual example 2 of the attribute form, with the role viral attribute.

Manual:

Calculation of a Component: "The keyword viral allows controlling the virality of the calculated Attributes".

Expected:

The input, plus the Viral Attribute At_1 = EP on every data point. calc combines no data points, so no propagation rule is involved: the attribute is only created.

Team decision:

#1257: as the comments on sdmx-twg/vtl#731 propose, a viral Attribute needs a propagation rule only where its values are combined, until the VTL Task Force discusses it.

script.vtl ⇩

DS_r := DS_1 [ calc viral attribute At_1 := "EP" ];

input/DS_1.csv ⇩

Id_1Me_1
110
220

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1At_1
110EP
220EP

expected/DS_r.json ⇩

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