• Global community
• Language:
• Deutsch
• English
• EspaÃ±ol
• FranÃ§ais
• PortuguÃªs
• æ—¥æœ¬èªžã‚³ãƒŸãƒ¥ãƒ‹ãƒ†ã‚£
Dedicated community for Japanese speakers
• í•œêµ­ ì»¤ë®¤ë‹ˆí‹°
Dedicated community for Korean speakers
Exit
• percentage

# percentage

New Here ,
Apr 14, 2019 Apr 14, 2019

Copied

I do not know Javascript and need emergency help with this calculation please. I would be so grateful if anyone with knowledge could assist. I need to create several percentage calculations in Acrobat Pro DC. I know where to put it just need to code. It looks something like this:

AP to 30 (expressed as \$) / % of Total

AP 31-60 (expressed as \$) / % of Total

AP 61-90 (expressed as \$) / % of Total

AP Over 90 (expressed as \$) \$ / % of Total

TOTAL (of AP above)

I need to know how to calculate to totals. There will be 4 separate scripts.

Thanks for any help!!!

TOPICS
Acrobat SDK and JavaScript , Windows

Views

477

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 Expert , Apr 15, 2019 Apr 15, 2019

Set the Format setting of the field to Percentage.

4 Replies 4
Community Expert ,
Apr 15, 2019 Apr 15, 2019

Copied

You can use something like this as the custom calculation script of your fields:

`var v1 = Number(this.getField("AP to 30").valueAsString);var v2 = Number(this.getField("Total").valueAsString);if (v2==0) event.value = "";else event.value = v1/v2;`

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Apr 15, 2019 Apr 15, 2019

Copied

Almost there thank you! The calculation is showing a % as a decimal, not as a whole number - like this:

AP to 30 = \$  100.00 / % of Total    0.25 %

AP 31-60 = \$  100.00 / % of Total    0.25â€‹ %

AP 61-90 = \$  100.00 / % of Total    0.25â€‹ %

AP Over 90 = \$  100.00 \$ / % of Total    0.25â€‹ %

TOTAL = \$  400.00

Do you know how to fix the decimal place to read 25%

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 Expert ,
Apr 15, 2019 Apr 15, 2019

Copied

Set the Format setting of the field to Percentage.

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
New Here ,
Apr 15, 2019 Apr 15, 2019

Copied

LATEST

Perfect. You are AWESOME! Thanks so much for taking the time to help me!