← calc operator page · clause/calc/multiple/items_are_independent
pandas ✅ · DuckDB ✅
calc Me_1 := Me_1 + 1, Me_2 := Me_1 * 10: the second item reads Me_1, which the first one recalculates.
Calculation of a Component: "The calcExpr sub-expressions are independent one another, they can only reference Components of the input Data Set and cannot use Components generated, for example, by other calcExpr."
Me_1 = 11 and 21, and Me_2 = 100 and 200, from the Me_1 of the input (10 and 20), not from the first item; a sequential evaluation would give 110 and 210.
DS_r := DS_1 [ calc Me_1 := Me_1 + 1, Me_2 := Me_1 * 10 ];
| Id_1 | Me_1 |
|---|---|
| 1 | 10 |
| 2 | 20 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | 11 | 100 |
| 2 | 21 | 200 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "Integer", "role": "Measure"},
{"name": "Me_2", "type": "Integer", "role": "Measure"}
]
}
]
}