Truncate a decimal number
Nasir_204951
Posts: 12
in Questions
What is the best way to truncate a decimal number? I tried using the Field: Set Value of a Decimal Field to take a decimal such as 0.18756 and just have the first 2 numbers after the decimal point, 0.18, but it automatically rounds it to 0.19. Is there a way to truncate this decimal without rounding it?
0
Best Answer

Thomas_937381 Posts: 196
@Nasir_204951 I think you could also multiply by 100, use the parseInt method, and then divide by 100.
5
Answers
The slice field formulas in the link down below may be able to help you around the rounding issue. I recommend trying this out in a field formula:
Slice returns characters starting with the first character as 0 and then counting up to character number N.
Field: Field Formulas > Text formula syntax
https://help.catalytic.com/docs/fieldfieldformulas/#textformulasyntax
thanks, @Thomas_937381 and @Jozef_783863 . I ended up going with the method Thomas described and achieved the desired result.