Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Rounding down

Community Beginner ,
Jun 26, 2020 Jun 26, 2020

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. 

TOPICS
Create PDFs , PDF forms
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Add this to the end of your code:

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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 26, 2020 Jun 26, 2020
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 26, 2020 Jun 26, 2020

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 27, 2020 Jun 27, 2020

As the custom calculation script of your field. And if it's not working provide more details for further help.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2020 Jun 28, 2020

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');

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Add this to the end of your code:

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 28, 2020 Jun 28, 2020

Oh thank you sooooo much!!!!! I have been working on this for days with so success. This worked perfectly!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 23, 2023 Dec 23, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 24, 2023 Dec 24, 2023
LATEST

It's Math, not math.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines