0

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

1574 0 3
Posted   one year 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   one year ago
  ●   Edited   one year 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
one year ago     Luke Hickey     279   |   4  

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

0
one year 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
one year ago     Brent Schlenker     130   |   5  

Awesome! Glad I could help.

0
avatar Luke Hickey   |    
Posted   one year 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
one year ago     gjackson5     13   |   3  

Hi Luke. The JavaScript Brent suggested provided the solution.

0
avatar Paul Schneider   |    
Posted   one year ago

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

Comments

( 0 )