← instr operator page · string/instr/comp_params/all_parameters_from_components
pandas ✅ · DuckDB ✅
instr(Me_1, Me_2, Me_3, Me_4) inside calc: pattern, start and occurrence all come from components.
String pattern location types occurrence as component<integer [value >= 1]> | integer [value >= 1], and "If the nth occurrence of the string-pattern after the start th character is not found in the input string, the returned value is 0."
Me_5 is 8, 4, 5 and 0: the 2nd o of hello world is at 8, an from the 3rd character of banana at 4, the 3rd o of o-o-o at 5, and hello has no 2nd o.
DS_r := DS_1[calc Me_5 := instr(Me_1, Me_2, Me_3, Me_4)];
| Id_1 | Me_1 | Me_2 | Me_3 | Me_4 |
|---|---|---|---|---|
| 1 | hello world | o | 1 | 2 |
| 2 | banana | an | 3 | 1 |
| 3 | o-o-o | o | 1 | 3 |
| 4 | hello | o | 1 | 2 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_2", "type": "String", "role": "Measure", "nullable": true},
{"name": "Me_3", "type": "Integer", "role": "Measure", "nullable": true},
{"name": "Me_4", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | Me_1 | Me_2 | Me_3 | Me_4 | Me_5 |
|---|---|---|---|---|---|
| 1 | hello world | o | 1 | 2 | 8 |
| 2 | banana | an | 3 | 1 | 4 |
| 3 | o-o-o | o | 1 | 3 | 5 |
| 4 | hello | o | 1 | 2 | 0 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Integer", "role": "Identifier"},
{"name": "Me_1", "type": "String", "role": "Measure"},
{"name": "Me_2", "type": "String", "role": "Measure"},
{"name": "Me_3", "type": "Integer", "role": "Measure"},
{"name": "Me_4", "type": "Integer", "role": "Measure"},
{"name": "Me_5", "type": "Integer", "role": "Measure"}
]
}
]
}