Highlighted

How to subtract in a calculation in Acrobat Pro 9

Community Beginner ,
Sep 08, 2008

Copy link to clipboard

Copied

I'm building a pdf with some calculations. I can do a 'sum, product,average,minimum,maximum'. But how do i subtract 2 fields?

Views

30.6K

Likes

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

How to subtract in a calculation in Acrobat Pro 9

Community Beginner ,
Sep 08, 2008

Copy link to clipboard

Copied

I'm building a pdf with some calculations. I can do a 'sum, product,average,minimum,maximum'. But how do i subtract 2 fields?

Views

30.6K

Likes

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
Sep 08, 2008 1
Adobe Community Professional ,
Sep 08, 2008

Copy link to clipboard

Copied

You will need to use JavaScript in a field's custom calculation script. For example:

// Get first field value
var v1 = getField("Text1").value;

// Get second field value
var v2 = getField("Text2").value;

// Set this field value equal to the difference
event.value = v1 - v2;

You would replace "Text1" and "Text2" with the names of the fields you've set up.

George

Likes

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
Reply
Loading...
Sep 08, 2008 4
New Here ,
Nov 06, 2020

Copy link to clipboard

Copied

I guess I'm missing something. I can't get this to work. Here is the script that I am using.

v1 = getField("Subtotal").value;
v2 = getField("TotalDiscount").value;
TotalDue.value = v1 - v2;

 

Any help would be appreciated.

 

Jack

 

Likes

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
Reply
Loading...
Nov 06, 2020 0
Adobe Community Professional ,
Nov 06, 2020

Copy link to clipboard

Copied

Use this:

event.value = v1 - v2;

Likes

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
Reply
Loading...
Nov 06, 2020 0
Adobe Community Professional ,
Sep 08, 2008

Copy link to clipboard

Copied

I should not have said you *need* to use JavaScript, because you can also use the "simplified field notation" option, but as you come to do more than the simplest of calculations, JavaScript is what you'll need.

If you want to use the simplified field notation option, you'd enter:

Text1 - Text2


but you'd replace Text1 and Text2 above with the names of your fields.

George

Likes

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
Reply
Loading...
Sep 08, 2008 2
Community Beginner ,
Sep 08, 2008

Copy link to clipboard

Copied

your the best, gonna try it out!

Likes

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
Reply
Loading...
Sep 08, 2008 0
Community Beginner ,
Sep 08, 2008

Copy link to clipboard

Copied

works!

Likes

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
Reply
Loading...
Sep 08, 2008 0
New Here ,
Mar 18, 2009

Copy link to clipboard

Copied

George - thank you so much! I didn't ask the question, but I certainly benefited from your assistance. Thanks so much! -dave

Likes

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
Reply
Loading...
Mar 18, 2009 0