← cast operator page Ā· general/cast/string_to_number_mask/decimal_mask

Decimal mask 🟢 all ok

pandas āœ… Ā· DuckDB āœ…

Tests:

cast(Me_1, number, "DD.DDD") on a String measure: the mask of the page's Example 1, cast(m1, number, "DD.DDD") + 2.

Manual:

Type Conversion and Formatting Mask: "ā€œDā€ one numeric digit (for the mantissa of the scientific notation)" and "ā€œ.ā€ (dot) can be used as a separator between the integer and the decimal parts".

Expected:

12.375, and 3.5 from 03.500: two digits, a dot and three digits. The conversion without a mask, which skips leading zeroes, gives the same: the mask shows in the strings that it refuses, such as 12.5 or 12.3755.

script.vtl ⇩

DS_r := DS_1[calc Me_2 := cast(Me_1, number, "DD.DDD")];

input/DS_1.csv ⇩

Id_1Me_1
112.375
203.500

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_1Me_2
112.37512.375
203.5003.5

expected/DS_r.json ⇩

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