← concat operator page · string/concat/sc_ds/prefix_and_null_measure

Prefix and null measure 🟢 all ok

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_1 is Dear Ann and Dear 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's length and instr examples show.

script.vtl ⇩

DS_r := "Dear " || DS_1;

input/DS_1.csv ⇩

Id_1Me_1
1Ann
2Bob
3

input/DS_1.json ⇩

{
  "datasets": [
    {
      "name": "DS_1",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier", "nullable": false},
        {"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
      ]
    }
  ]
}

expected/DS_r.csv ⇩

Id_1Me_1
1Dear Ann
2Dear Bob
3

expected/DS_r.json ⇩

{
  "datasets": [
    {
      "name": "DS_r",
      "DataStructure": [
        {"name": "Id_1", "type": "Integer", "role": "Identifier"},
        {"name": "Me_1", "type": "String", "role": "Measure"}
      ]
    }
  ]
}