String concatenation · ||
---
config:
flowchart:
useMaxWidth: false
---
flowchart TB
classDef ok fill:#d4edda,stroke:#28a745,color:#000
classDef partial fill:#fff3cd,stroke:#ffc107,color:#000
classDef refused fill:#d4edda,stroke:#28a745,stroke-width:3px,stroke-dasharray: 2 2,color:#000
classDef missing fill:#f8d7da,stroke:#dc3545,color:#000
classDef diverge fill:#cce5ff,stroke:#007bff,color:#000
classDef block fill:#2b3a4a,stroke:#2b3a4a,color:#fff,font-weight:bold
classDef ext fill:#fff,stroke:#666,color:#000,stroke-dasharray: 5 5
O["String concatenation · #124;#124;<br/>🟢7"]:::ok
subgraph G_ds["Dataset"]
direction LR
v_ds_ds["DS #124;#124; DS"]:::ok
v_ds_sc["DS #124;#124; sc"]:::ok
v_sc_ds["sc #124;#124; DS"]:::ok
end
subgraph G_comp["Component"]
direction LR
v_comp_comp["comp #124;#124; comp"]:::ok
v_comp_sc["comp #124;#124; sc"]:::ok
v_sc_comp["sc #124;#124; comp"]:::ok
end
subgraph G_sc["Scalar"]
direction LR
v_sc_sc["sc #124;#124; sc"]:::ok
end
O --- G_ds
O --- G_comp
O --- G_sc
style G_ds fill:#f8f9fa,stroke:#495057,stroke-width:2px
style G_comp fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 8 5
style G_sc fill:#f8f9fa,stroke:#495057,stroke-width:2px,stroke-dasharray: 2 3
click v_ds_ds href "#form-ds-ds"
click v_ds_sc href "#form-ds-sc"
click v_sc_ds href "#form-sc-ds"
click v_comp_comp href "#form-comp-comp"
click v_comp_sc href "#form-comp-sc"
click v_sc_comp href "#form-sc-comp"
click v_sc_sc href "#form-sc-sc"
Types
Takes string · Gives string
Comes from · string — 12 operators in 3 blocks 🟢12
General purpose operators (2) 🟢2
String operators (7) 🟢7
Data validation operators (3) 🟢3
Comes from · operators that return any type (their input's) — 37 operators in 8 blocks 🟢37
General purpose operators (5) 🟢5
Join operators (4) 🟢4
Time operators (3) 🟢3
Set operators (4) 🟢4
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (8) 🟢8
Conditional operators (3) 🟢3
Goes to · string — 16 operators in 5 blocks 🟢16
General purpose operators (1) 🟢1
String operators (10) 🟢10
Comparison operators (1) 🟢1
Data validation operators (1) 🟢1
Definitions (VTL-DL) (3) 🟢3
Goes to · operators that take any scalar — 49 operators in 9 blocks 🟢49
General purpose operators (6) 🟢6
Join operators (4) 🟢4
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (10) 🟢10
Data validation operators (1) 🟢1
Conditional operators (3) 🟢3
Clause operators (9) 🟢9
Definitions (VTL-DL) (1) 🟢1
Forms
DS || DS 🟢 · string → string
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
the measure of
DS_1followed by that ofDS_2, on each data point.- Manual:
String concatenation, Example 1, output verbatim: “Concatenates two strings.”
- Expected:
Me_1ishelloworldfor (1, A) andhitherefor (2, B).
DS_r := DS_1 || DS_2;
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | hello |
| 2 | B | hi |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | world |
| 2 | B | there |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | helloworld |
| 2 | B | hithere |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · input/DS_2.csv · input/DS_2.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
DS || sc 🟢 · string → string
Suffix and null measure 🟢 pandas ✅ · DuckDB ✅
- Tests:
DS_1 || "!": a scalar appended to every value, where one measure is null.- Manual:
String concatenation: “Concatenates two strings.” The scalar is composed with every measure: “An operand Scalar value is composed with all the Measures of the other operand” (Typical behaviours).
- Expected:
Me_1ishello!andworld!. A null operand gives a null result: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null” (User Manual), as the manual’slengthandinstrexamples show.
DS_r := DS_1 || "!";
| Id_1 | Me_1 |
|---|---|
| 1 | hello |
| 2 | world |
| 3 |
| Id_1 | Me_1 |
|---|---|
| 1 | hello! |
| 2 | world! |
| 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc || DS 🟢 · string → string
Prefix and null measure 🟢 pandas ✅ · DuckDB ✅
- Tests:
"Dear " || DS_1: a scalar put before every value, so that the order of the operands shows; one measure is null.- Manual:
String concatenation: “Concatenates two strings.” The scalar is composed with every measure: “An operand Scalar value is composed with all the Measures of the other operand” (Typical behaviours).
- Expected:
Me_1isDear AnnandDear Bob: the scalar is the left operand, so it comes first. A null operand gives a null result: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null” (User Manual), as the manual’slengthandinstrexamples show.
DS_r := "Dear " || DS_1;
| Id_1 | Me_1 |
|---|---|
| 1 | Ann |
| 2 | Bob |
| 3 |
| Id_1 | Me_1 |
|---|---|
| 1 | Dear Ann |
| 2 | Dear Bob |
| 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
comp || comp 🟢 · string → string
Null right operand 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 || Me_2insidecalc, whereMe_2is null in one data point.- Manual:
String concatenation: “Concatenates two strings.” A new component “is added to the original Components of DS_1, by default as a Measure” (Typical behaviours).
- Expected:
Me_3isfoobarandabcd;Me_1andMe_2are kept. A null operand gives a null result: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null” (User Manual), as the manual’slengthandinstrexamples show.
DS_r := DS_1[calc Me_3 := Me_1 || Me_2];
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | foo | bar |
| 2 | ab | cd |
| 3 | x |
| Id_1 | Me_1 | Me_2 | Me_3 |
|---|---|---|---|
| 1 | foo | bar | foobar |
| 2 | ab | cd | abcd |
| 3 | x |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
comp || sc 🟢 · string → string
Manual example 2 🟢 pandas ✅ · DuckDB ✅
- Tests:
Me_1 || " world"insidecalc, where the new measureMe_2takes the result.- Manual:
String concatenation, Example 2, output verbatim: “Concatenates two strings.”
- Expected:
Me_2ishello worldandhi world;Me_1is kept.
DS_r := DS_1[calc Me_2 := Me_1 || " world"];
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | hello |
| 2 | B | hi |
| Id_1 | Id_2 | Me_1 | Me_2 |
|---|---|---|---|
| 1 | A | hello | hello world |
| 2 | B | hi | hi world |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc || comp 🟢 · string → string
Prefix and null component 🟢 pandas ✅ · DuckDB ✅
- Tests:
"Hello " || Me_1insidecalc, whereMe_1is null in one data point.- Manual:
String concatenation: “Concatenates two strings.” A new component “is added to the original Components of DS_1, by default as a Measure” (Typical behaviours).
- Expected:
Me_2isHello WorldandHello VTL;Me_1is kept. A null operand gives a null result: “most of the scalar operations (arithmetic, logical, and others) return null when any of their arguments is null” (User Manual), as the manual’slengthandinstrexamples show.
DS_r := DS_1[calc Me_2 := "Hello " || Me_1];
| Id_1 | Me_1 |
|---|---|
| 1 | World |
| 2 | VTL |
| 3 |
| Id_1 | Me_1 | Me_2 |
|---|---|---|
| 1 | World | Hello World |
| 2 | VTL | Hello VTL |
| 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
sc || sc 🟢 · string → string
Two strings 🟢 pandas ✅ · DuckDB ✅
- Tests:
the concatenation of two input scalars,
SC_1 || SC_2withSC_1=HelloandSC_2=, World.- Manual:
String concatenation: “Concatenates two strings. For example,
"Hello" || ", World"gives"Hello, World".”- Expected:
SC_risHello, World, a String.
SC_r := SC_1 || SC_2;
| SC_1 | SC_2 |
|---|---|
| Hello | , World |
Name |
Type |
Value |
|---|---|---|
|
String |
|
Files: script.vtl · input/scalars.csv · input/scalars.json · expected/scalars.json · example page ↗