Solved

ADOBE FORM-CALCULATION FORMULA

Posted on 2008-10-13
3
3,249 Views
Last Modified: 2008-10-15
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
0
Comment
Question by:nursecore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 6

Expert Comment

by:gxp071
ID: 22722449

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;
}

Open in new window

0
 
LVL 6

Accepted Solution

by:
gxp071 earned 500 total points
ID: 22722470
yep just wack the % string on the end.  sorry left off the link last time

http://www.adobe.com/devnet/acrobat/javascript.html 


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;
}

Open in new window

0
 

Author Comment

by:nursecore
ID: 22723384
Thanks this solution worked great!!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question