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!!!
Set the Format setting of the field to Percentage.
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;
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%
Copy link to clipboard
Copied
Set the Format setting of the field to Percentage.
Copy link to clipboard
Copied
Perfect. You are AWESOME! Thanks so much for taking the time to help me!