← trunc operator page · numeric/trunc/ds_no_digits/two_number_measures

Two number measures 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

trunc with numDigit omitted, on a dataset with two Number measures.

Manual:

Truncation: "The basic scalar type of the result is integer if numDigit is omitted"; the result is typed dataset { measure<number> _+ }, and the unary operators give "homonymous Measures in DS_r".

Expected:

both measures keep their names and become Integers: Me_1 3, 2 and 7, Me_2 12345, 0 and 5. Ceiling and Floor Example 1 do the same, and nothing puts trunc among the "Operators changing the data type", which allow one measure only.

script.vtl ⇩

DS_r := trunc(DS_1);

input/DS_1.csv ⇩

Id_1Me_1Me_2
13.1415912345.6
22.718280.4
37.25.9

input/DS_1.json ⇩

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

expected/DS_r.csv ⇩

Id_1Me_1Me_2
1312345
220
375

expected/DS_r.json ⇩

{
  "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"}
      ]
    }
  ]
}