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

how do i add and subtract more than one field

New Here ,
Apr 06, 2016 Apr 06, 2016

I have 4 fields

field1 is the begining balance

field2 is amount collected (i want to add this to the field1)

field3 is refunds (i want to subtract that from the total of the first two)

field4 is checks written (again I want to subtract this from the top three)

field5 is where I want the ending balance to go

How do I write this.  Do I use script or simplified?

TOPICS
Acrobat SDK and JavaScript , Windows
523
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 ,
Apr 06, 2016 Apr 06, 2016

You can use the simplified calculation script of field5, like this (if I understood you correctly):

(field1 + field2) - (field3 + field4)

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
New Here ,
Apr 06, 2016 Apr 06, 2016

I just tried that.  But the number is not showing up.  It is not giving me an error.  I recopied all the field names.  They don't have any spaces in them.  Should their be spaces between the + and the - in your equation?

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 ,
Apr 06, 2016 Apr 06, 2016

Spaces are not necessary, but might be helpful.

Check the JS Console for errors (Ctrl+J). Also, keep in mind the script will only "kick in" when you change the value of one of the fields after you enter it.

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
New Here ,
Apr 06, 2016 Apr 06, 2016

Thank helps with another problem.  Thank you.  I will look at the Ctrl+j.....

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
New Here ,
Apr 06, 2016 Apr 06, 2016

it gives me error messages that say field has not been defined. and missing : and ; before statment

Where do these go in the script equation?

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 ,
Apr 06, 2016 Apr 06, 2016
LATEST

That means you used the wrong field name. Keep in mind that JS is

case-sensitive, so if the field is called "Text1" you can't use "text1"...

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