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

percentage

New Here ,
Apr 14, 2019 Apr 14, 2019

Copy link to clipboard

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

428

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

Set the Format setting of the field to Percentage.

Votes

Translate

Translate
Community Expert ,
Apr 15, 2019 Apr 15, 2019

Copy link to clipboard

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;

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

Copy link to clipboard

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%

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

Copy link to clipboard

Copied

Set the Format setting of the field to Percentage.

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

Copy link to clipboard

Copied

LATEST

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

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