I have a Form that I need a calculated field in, but I don't know the scripting enough to do what I want.  Here is the formula in lamans terms.

((Field 2) - (Field 1) )/(Field 1)

This would then be a % output.
Thanks
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:

add the code below to the "Custom Calculation script:" of the textFeild calcuation tab.

Code below also rounds to 2 dp.  its basically just Javascript, read these for more details on using javascript in a pdf.  I'm just looking up how to append the '%' symbol but probably just a matter of adding at the end..
``````
event.value = roundNumber( ( this.getField('Field 2').value - this.getField('Field 1').value  )  / this.getField('Field 1').value , 2 );

function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
``````
Commented:
yep just wack the % string on the end.  sorry left off the link last time

``````event.value = roundNumber( ( this.getField('Field 2').value - this.getField('Field 1').value  )  / this.getField('Field 1').value , 2 ) + '%';

function roundNumber(num, dec) {
var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
return result;
}
``````

Experts Exchange Solution brought to you by