Skip to main content

2 replies

ls_rbls
Community Expert
Community Expert
September 24, 2025

Hello @Tori36186819mjz7 , 

 

It's important to understand that Adobe Acrobat uses a JavaScript core interpreter to perform various systematic actions and arithmetic calculations.

 

As @Nesa Nurani  and @Thom Parker  pointed out, like any programming language, particularly Acrobat JavaScript, all arithmetic formulas you create must adhere to specific expressions and Acrobat JavaScript rules to achieve the intended outcome.

 

I think you were specifically talking about using a Simplified Field Notation (SFN), which is distinct from the solutions that have already been shared since your original post mentions JavaScript. It creates a bit of confusion for us trying to understand your requirement.

In this context, writing a simplified field notation requires a different syntax than that of a Custom Calculation Script. Additionally, in your shared PDF you disregarded the advice that @try67  and @PDF Automation Station  already shared with you in your intial post: https://community.adobe.com/t5/acrobat-discussions/simple-multiplication-of-two-fields/td-p/15516016

 

The names of the fields that you will refer to in your scripts need to be spelled precisely as you wrote them when you created them. Currently, you spelled all of the field names in your SFN in Upper Case, but your fields are spelled  Case Sensitive. I've noticed in your shared document that you also have the same error in other total fields.

 

Note that, with the exception of the field "LESSADVANCES", your SFN syntax should be expressed exaclty as :

 

TotalOne + TotalTwo + TotalThree - LESSADVANCES

 

Additionally, because SFN mostly resembles arithmetic expressions (rather than JavaSript scripting expressions), if you are employing SFN expressions, you should get in the habit of expressing arithmetic formulas like so:

 

(TotalOne + TotalTwo + TotalThree) - LESSADVANCES

 

Employing parenthesis  ( )  in arithmetic formulas greatly helps someone to visually grasp the execution order of an equation if they would be reviewing your work; it just makes it a lot easier to understand in a human-readable form what needs to happen first in an equation.

 

Also, you've used the Custom Calculation Script to declare the value of "GrandTotal" using the SFN syntax in it.

 

Should you decide to keep your work entirely as SFN, move the expresion of  TotalOne + TotalTwo + TotalThree - LESSADVANCES  to the Simplified Field Notation item under the Claculate tab (like you've done before). Otherwise, you may copy and paste the scripts provided by @Nesa Nurani and @Thom Parker and use them to test your results as Custom Calcution Scripts (not SFN); both methods should trigger the same result values.

 

Here is an updated PDF from your original work with some improvements:  Travel-Expense-2025 

Participant
September 24, 2025

Thanks for your advice.  I'm still learning!

Nesa Nurani
Community Expert
Community Expert
September 22, 2025

I answered you in another post, you can't use that in custom calculation script, use the same under simplified field notation or use this in custom calculation script:

var a = Number(this.getField("TOTALONE").valueAsString);
var b = Number(this.getField("TOTALTWO").valueAsString);
var c = Number(this.getField("TOTALTHREE").valueAsString);
var d = Number(this.getField("LESSADVANCES").valueAsString);

event.value = a+b+c-d;
Participating Frequently
September 22, 2025

Thank you for your help...but I still do get a total in the GRAND TOTAL field.

Can you help me with that?  Do I need a calculate button?  Which I have no idea on how to creat.

Participating Frequently
September 22, 2025

Would you mind looking at the calculation for the field GRANDTOTAL?