How to round numbers after decimal point

Is there any way how can I round numbers?

Round up or round down or just round.

And how round to hundredths from thousandths after decimal point?

Thank you.

Hi Thomas,
The question is pretty general. Do you mean in OnChange script? In a calculated field?
Both of them are javascript. So any command which will work for you

  • Math.ceil
  • Math.round
  • Math.floor


Yes, I mean in OnChange script.

I need to round number like 7658.4589 to 7658,46

i tried .toFixed(2) but it doesnt work.

toFixed retuns formatted string. Do you want to put it into some number field?
This works for me:

if (doo.model.<[Check (xo0pu6zsyb)]>.value) {
  doo.model.<[Number (number)]>.value = doo.functions.math.round(doo.model.<[Number (number)]>.value, 2);

This code works for me as well

alert(doo.model.<[Number (number)]>.value.toFixed(2))


1 Like

Thanks :slight_smile: works perfectly