Sum function script not updating field when variables being blank

New Here ,
Feb 07, 2018

Copy link to clipboard

Copied

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

Views

96

Likes

Translate

Translate

Report

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

Sum function script not updating field when variables being blank

New Here ,
Feb 07, 2018

Copy link to clipboard

Copied

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

Views

97

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 07, 2018 0
Most Valuable Participant ,
Feb 07, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
New Here ,
Feb 07, 2018

Copy link to clipboard

Copied

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!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
Most Valuable Participant ,
Feb 07, 2018

Copy link to clipboard

Copied

That means you didn't solve the problem I pointed out...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
New Here ,
Feb 07, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
Adobe Community Professional ,
Feb 07, 2018

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
New Here ,
Feb 07, 2018

Copy link to clipboard

Copied

Got it thank you

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0
Adobe Community Professional ,
Feb 07, 2018

Copy link to clipboard

Copied

Sorry, far right panel.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 07, 2018 0