Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Javascript subtraction calculation in Adobe Acrobat Pro DC

Guest
Feb 26, 2018 Feb 26, 2018

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?

TOPICS
PDF forms
6.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
LEGEND ,
Feb 26, 2018 Feb 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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2018 Feb 26, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2018 Feb 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

HEY HEY...it worked!!! I added the underlines between words and got the result I expected.

You're a life saver, this was driving me nuts!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2018 Feb 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

George...the underline(s) worked. I'll stick to that...any success at this juncture is gold!! Thanks for helping out.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

AND...my first attempt is no longer working........

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2018 Feb 26, 2018

Double check the field names, check the JavaScript console (Ctrl+J) for errors, and check that the field calculation order (not the same as the tab order) is correct.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018
LATEST

Roger, thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 26, 2018

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

MDLTOTALAMOUNTRow1

AMOUNTTHISPAYMENTRow1

TOTALPREVIOUSPAYMENTSRow1

Still doesn't work...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2018 Feb 26, 2018

Did you update the formula accordingly?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2018 Feb 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!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines