Skip to main content
Participant
June 26, 2020
Answered

Rounding down

  • June 26, 2020
  • 1 reply
  • 1480 views

I'm trying to get a field in my pdf to round down or basically drop any cents after the decimal. For example I want $283.50 to be $283 not $284. It's a field that is giving the average of several other fields. 

This topic has been closed for replies.
Correct answer try67

I am working on  a form for work, per our policy we drop the cents on all income amounts. I am looking to just get whole dollar amounts without the results rounding up. For example if the total income is $283.50. I need it to be $283. This Field is an average of other fields. When I use this script it averages right, but I can't figure out how to add the Math.floor script so that any value that goes into the field doesnt round up. 

event.value = Avg("Pay1", "Pay2", 'Pay3', 'Pay4', 'Pay5', 'Pay6', 'Pay7', 'Pay8', 'Pay9','Pay10', 'Pay11', 'Pay12', 'Pay13');


Add this to the end of your code:

event.value = Math.floor(event.value);

1 reply

Old_Salt
Participating Frequently
June 27, 2020
HayestfAuthor
Participant
June 27, 2020

It's not working, where should I use this script? 

Participating Frequently
December 24, 2023

Add this to the end of your code:

event.value = Math.floor(event.value);


I tried this and it didn't work.

event.value = math.floor(Level / 2)

It keeps rounding up instead of down if I format it as number and giving decimal if I format as none.