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

Sum function script not updating field when variables being blank

New Here ,
Feb 07, 2018 Feb 07, 2018

Earlier, I asked how to hide values if the the value=0 and got the correct script to put in.

The script I used for this was:

var amount = Number(this.getField("Qty2").value) * Number(this.getField("UP2").value);

event.value = (amount==0) ? "" : amount;

However, the sum function for the "Subtotal" field is now not updating. I am using the sum function in the calculator tab. Am I suppose to put in a script now or can I still use the sum function? Please see the snapshot below. Thanks!

TOPICS
Acrobat SDK and JavaScript , Windows
623
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 07, 2018 Feb 07, 2018

Check the field calculation order. The Subtotal field needs to be calculated after the Amount field(s).

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 ,
Feb 07, 2018 Feb 07, 2018

Thanks!

I had to manually type in the addition of each field as the sum function doesn't do it in the correct order.

Thanks for all your help!

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 07, 2018 Feb 07, 2018

That means you didn't solve the problem I pointed 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
New Here ,
Feb 07, 2018 Feb 07, 2018

Sorry, I'm new to this so I don't have much experience. Can you explain what you mean?

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 07, 2018 Feb 07, 2018

In the "Prepare form" mode in Acrobat there is a drop menu on the far left panel with an entry for setting the calculation order. You need to check this and make sure the "SubTotal" field is at the bottom of the list.

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

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 ,
Feb 07, 2018 Feb 07, 2018

Got it thank you

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 07, 2018 Feb 07, 2018
LATEST

Sorry, far right panel.

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

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