← define_operator operator page · definitions/define_operator/component/identifier_in_calc
pandas ✅ · DuckDB ✅
a parameter of type identifier<integer>, called inside calc with the Identifier Id_1.
define operator: componentRole ::= component | identifier | measure | attribute | viral attribute. The script ends with end operator, as the page's examples and the grammar do; its syntax line writes end define operator.
Me_2 = Id_1 * 10, a new Measure that calc adds: (1, 10, 10) and (2, 20, 20).
define operator times_ten (c identifier<integer>)
returns component<integer> is
c * 10
end operator;
DS_r := DS_1[calc Me_2 := times_ten(Id_1)];
| 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 | 10 | 10 |
| 2 | 20 | 20 |
{
"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"
}
]
}
]
}