0

I need to truncate the decimal places not round up the number; how do I do this?

853 0 3
Posted   7 months ago

I've created a survey and a variable to report out the survey results.I need the decimal places as I report out on the measure.  How do I truncate to 2 decimal places?

 

Thanks in advance

 

Comments

( 0 )

Answers  ( 3 )

0
Posted   7 months ago
  ●   Edited   7 months ago

I've used VariableName.toFixed(x)

However many number you want to have AFTER the decimal is the number you put in (x).

Here's a link: W3Schools Reference to Javascript .toFixed(x)

 

 

Comments

( 3 )
0
7 months ago     Luke Hickey     253   |   4  

Brent, use a name on your link so it looks better on a mobile. Links don’t wrap on community.

0
7 months ago     gjackson5     13   |   3  

Thanks, Brent! This is exactly what I needed. Btw - it also rounds on the hundredth place, which is even better :)

0
7 months ago     Brent Schlenker     100   |   4  

Awesome! Glad I could help.

0
avatar Luke Hickey   |    
Posted   7 months ago

Have you looked at using JavaScript? here's a link to the JS function it sounds like you would want. 
 

W3Schools.com

Comments

( 1 )
0
7 months ago     gjackson5     13   |   3  

Hi Luke. The JavaScript Brent suggested provided the solution.

0
avatar Paul Schneider   |    
Posted   7 months ago

This article might be helpful too: https://dki.io/ba21af62

Comments

( 0 )