← trunc operator page · numeric/trunc/sc_comp_digits/digits_from_component

Digits from component 🟢 all ok

pandas ✅ · DuckDB ✅

Tests:

a scalar operand with numDigit given by an Integer component, inside calc.

Manual:

Truncation types numDigit as component<integer> | integer, so it may be a component while the operand is a scalar.

Expected:

the error 1-1-15-8, "At op {op}: {op} operator cannot have a {comp_type} as parameter": by a team decision, numDigit is a Component only when the operand is a Component too.

script.vtl ⇩

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

input/DS_1.csv ⇩

Id_1Me_1
12
24
30

input/DS_1.json ⇩

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

expected/error.json ⇩

{"code": "1-1-15-8"}