Skip to main content
February 26, 2018
Answered

Javascript subtraction calculation in Adobe Acrobat Pro DC

  • February 26, 2018
  • 3 replies
  • 6609 views

I have 3 fields I need to subtract to get a total. I've read several examples watched an online video that describes how to subtract 2 numbers to get a sum, but I can't get this to work.

Field names are:

MDL TOTAL AMOUNTRow1

AMOUNT OF THIS PAYMENTRow1

TOTAL AMOUNT OF PREVIOUS PAYMENTSRow1

I wrote the equation like this: MDL TOTAL AMOUNTRow1-AMOUNT OF THIS PAYMENTRow1-TOTAL AMOUNT OF PREVIOUS PAYMENTSRow1

Any suggestions?

This topic has been closed for replies.
Correct answer George_Johnson

It will work if you remove the spaces from the field names and update the simplified field notation using the new field names, e.g.,

MDL_TOTAL_AMOUNTRow1 - AMOUNT_OF_THIS_PAYMENTRow1 - TOTAL_AMOUNT_OF_PREVIOUS PAYMENTSRow1

3 replies

February 26, 2018

Found another video; went back and edited existing field names, removing spaces. New field names:

MDLTOTALAMOUNTRow1

AMOUNTTHISPAYMENTRow1

TOTALPREVIOUSPAYMENTSRow1

Still doesn't work...

try67
Community Expert
Community Expert
February 26, 2018

Did you update the formula accordingly?

February 26, 2018

Try...I thought I did. I used the underlines in George's example and it worked. I'm golden! Thanks for jumping in!!

George_JohnsonCorrect answer
Inspiring
February 26, 2018

It will work if you remove the spaces from the field names and update the simplified field notation using the new field names, e.g.,

MDL_TOTAL_AMOUNTRow1 - AMOUNT_OF_THIS_PAYMENTRow1 - TOTAL_AMOUNT_OF_PREVIOUS PAYMENTSRow1

February 26, 2018

George...sorry, but you lost me. I removed the spaces (actually was updating my post as yours showed up) but then you inserted underlines between the words. Is that what is needed still?

February 26, 2018

You don't need to use underlines, you could instead do what you said you did by removing the spaces. You need to make sure you're using the exact field names, and then check the JavaScript console (Ctrl+J) to see if any errors are reported there.


George...maybe I was a little too excited a little too quickly.

I've got 10 rows of the same calculation, differentiated by "Row1" Row2" Row3" etc. I did the exact thing on Line 2(copied, pasted and changed the 1 to a 2 and the 1 to a 3) on lines 2 & 3 and can't get the formula to work.

Arrrggghhhh...suggestions?

try67
Community Expert
Community Expert
February 26, 2018

That should work, but you need to add a back-slash before each space in the fields' names.

February 26, 2018

try67...removed the spaces for simplicity sake (was posting new field names as your post showed up)...still no joy...