Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Add this to the end of your code:
event.value = Math.floor(event.value);
Copy link to clipboard
Copied
Copy link to clipboard
Copied
It's not working, where should I use this script?
Copy link to clipboard
Copied
As the custom calculation script of your field. And if it's not working provide more details for further help.
Copy link to clipboard
Copied
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');
Copy link to clipboard
Copied
Add this to the end of your code:
event.value = Math.floor(event.value);
Copy link to clipboard
Copied
Oh thank you sooooo much!!!!! I have been working on this for days with so success. This worked perfectly!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
It's Math, not math.