Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

Numeric literal example:

TRUNCPI
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
trunc(
pi())

...

trunc(pi())

Output: Returns the value 3.

Expression example:

TRUNC
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
trunc(length_in * length_in, 2)

trunc(length_in * length_in, 2)

Output:

...

Returns the square of the values in length_in, truncated to two decimal points.

D s
snippetSyntax

TRUNC
d-codelang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:
trunc(numeric_value,integer_value)

trunc(numeric_value,integer_value)


ArgumentRequired?Data TypeDescription
numeric_valueYstring, decimal, or integerName of column or Decimal or Integer literal to apply to the function
integer_valueNinteger

Number of digits to which to truncate.

  • Default is 0, which truncates to the nearest integer.
  • Negative integer values can be applied.

...

RowIdmyVal
r011.2345
r02-1.2345
r03100.000
r0410.1
r0550.029

TransformTransformation:

d-

...

trans
RawWrangletrue
p03Value'trunc_myVal'
Typestep
WrangleTextderive type:single value:

...

trunc(myVal) as: 'trunc_myVal'

...

p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuetrunc(myVal)
p03NameNew column name
SearchTermNew formula

D trans
RawWrangletrue
p03Value'trunc_myVal2'
Typestep
WrangleTextderive type:single value:

...

trunc(myVal,2) as: 'trunc_myVal2'

...

p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuetrunc(myVal,2)
p03NameNew column name
SearchTermNew formula

D trans
RawWrangletrue
p03Value'trunc_myVal_2'
Typestep
WrangleTextderive type:single value:

...

trunc(myVal,2) as: 'trunc_myVal_2'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valuetrunc(myVal,2)
p03NameNew column name
SearchTermNew formula

Results:

RowIdmyValtrunc_myValtrunc_myVal2trunc_myVal_2
r011.234511.230
r02-1.2345-1-1.230
r03100.000100100.00100
r0410.11010.10
r0550.0295050.020

...