These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Help with Percentage

Lubu
Registered: Mar 19 2010
Posts: 6
Answered

Hi,

I'm new user of acrobat 9.

I'm trying to calcalute a percentage and I'm having problems with calculation script
var c = Number(this.getField("P3").value);
var d = Number(this.getField("P4").value);
var T2=(d/c)*100;
if(c < 1 || isNaN(T2))
event.value = 0;
else
event.value = T2;

When I put format on T2 as "Number" in properties if I insert P3=10 and P4=10 I get the result 100.00 and if I change de format to "percentage it shows 10,000.00%.

Please help
Kind Regards
Lubu

My Product Information:
Acrobat Pro 9.3.1
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Percentage is represented as a number between 0 and 1. So divide your number by 100 if you want the percentage to be between 0 and 100 (or just don't multiply it by 100 earlier in the code).

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com