• Global community
• Language:
• Deutsch
• English
• Español
• Français
• Português
• 日本語コミュニティ
Dedicated community for Japanese speakers
• 한국 커뮤니티
Dedicated community for Korean speakers
Exit
• Subtraction in Simplified Notation keeps subtracti...

Subtraction in Simplified Notation keeps subtracting when inputting other field

Community Beginner ,
Mar 31, 2024 Mar 31, 2024

Copied

I used a simplified notation:

Field 1= E17-K19

Field 2= K19

Field 3= E21-K23

Field 4= K23

and when I input all the other fields, Field 1 and Field 3 just keeps subtracting from the amount minus from fields 2 & 4 respectively. How can I stop them from subtracting repetitively while I input data from other fields? I just want them to subtract once. Is there a problem on my set calculation order?

TOPICS
How to , JavaScript , PDF , PDF forms

Views

116

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
4 Replies 4
Community Expert ,
Mar 31, 2024 Mar 31, 2024

Copied

Report

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

Copied

You need to provide complete information when posting questions.

In this case, how are Field 1-3 related to the "E" and "K" fields?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Report

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

Copied

E17=   -> (in Simplified Notation) E17-K19

K19=  ->K19

E21=  -> (in Simplified Notation) E21-K23

K23=  -> K23

I am sorry for the confusion.

How can I stop them from subtracting repetitively while I input data from other fields? I just want them to subtract once. Is there a problem on my set calculation order?

Report

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

Copied

LATEST

Yes, there is a huge problem with the calculations.

Lets walk through the sequence of actions for the E17 calculations.

1. User enters the value 3 into K19.

2. This triggers the calculation script on E17.

3. At this point lets say that E17 is 0, so the result is -3.

4. Now the user clicks on a checkbox somewhere else on the form.

5. This also triggers the calculation script on E17.

6. Since E17 is -3, the new result is -6.

7. Repeat steps 5 and 6 everytime any field on the form is changed.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often