← membership operator page · general/membership/viral_attribute/manual_ex_6
pandas ✅ · DuckDB ✅
DS_2#At_1 on a viral attribute: a new measure with its values, and At_1 kept as viral.
Membership, Example 6: "If comp is an Attribute, it follows the Attribute propagation rule too", and the result has "a single Measure". The manual's ds_2.json names its dataset DS_1, a slip: the example loads it as DS_2, the name that the page and the script give it.
Id_1, Id_2, str_var with the values of At_1, and the viral At_1; the values are the manual's.
string_var is written str_var, as in Manual example 3.
#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.
DS_r := DS_2#At_1;
| Id_1 | Id_2 | Me_1 | Me_2 | At_1 |
|---|---|---|---|---|
| 1 | A | 1 | 5 | |
| 1 | B | 2 | 10 | P |
| 2 | A | 3 | 12 |
{
"datasets": [
{
"name": "DS_2",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "At_1", "type": "String", "role": "ViralAttribute", "nullable": true}
]
}
]
}
| Id_1 | Id_2 | str_var | At_1 |
|---|---|---|---|
| 1 | A | ||
| 1 | B | P | P |
| 2 | A |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Id_2", "type": "String", "role": "Identifier"},
{"name": "str_var", "type": "String", "role": "Measure"},
{"name": "At_1", "type": "String", "role": "ViralAttribute"}
]
}
]
}