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

Rounding down

Community Beginner ,
Jun 26, 2020 Jun 26, 2020

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. 

TOPICS
Create PDFs , PDF forms

Views

651

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jun 28, 2020 Jun 28, 2020

Add this to the end of your code:

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

Votes

Translate

Translate
Participant ,
Jun 26, 2020 Jun 26, 2020

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Add this to the end of your code:

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

It's Math, not math.

Votes

Translate

Translate

Report

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