← trunc operator page · numeric/trunc/comp_placeholder/placeholder_for_digits

Placeholder for digits 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

the placeholder _ for numDigit, on a component inside calc.

Manual:

Truncation: "trunc ( 12345.6, _ ) gives 12345".

Expected:

Me_2 = trunc(Me_1, _) is an Integer, as with numDigit omitted: 3.14159, 2.71828 and 12345.6 give 3, 2 and 12345; the other components are kept.

script.vtl ⇩

DS_r := DS_1[calc Me_2 := trunc(Me_1, _)];

input/DS_1.csv ⇩

Id_1Me_1
13.14159
22.71828
312345.6

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

expected/DS_r.csv ⇩

Id_1Me_1Me_2
13.1415903
22.7182802
312345.60000012345

expected/DS_r.json ⇩

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