Copy link to clipboard
Copied
I have a pdf where the user enters info and the last page does all the calculation. The calculation is done in the fields, it involves averages. It is slow because each time any information is entered all the fields on the last page recalulates. I would like to switch off recalculation on that page until the user clicks a "calculate" button. Is that possible?
Or even if I could switch off refresh for the entire document until a button is clicked.
I found this code but I am not sure where to put it or how to make it work. Can anyone help?
Thanks in advance
{
this.delay = true;
}
{
this.delay = false;
}
1 Correct answer
Yes: this.calculateNow();
Copy link to clipboard
Copied
You can use the calculations at the "calculate" button.
Copy link to clipboard
Copied
Would I then put all the calculations into the button? There are a lot of cacluations in the fields involving mean average. I would not know how to start this in javascript. Perhaps I have not been clear, I need the fields on page 9 of my document or my whole document not to caculate until I press a button. Many thanks
Copy link to clipboard
Copied
What calculations do you use?
Copy link to clipboard
Copied
Hi Bernd
I am pulling the values from a number of fields and using the average function. Then I pulling information from those fields to make a mean average. The field calculation works a treat. No complaints. It is just that for speed I want them to do the calculation at the end once all the data has been entered.
Many thanks for any help you can give
Copy link to clipboard
Copied
Use the "calculate" property, instead.
Copy link to clipboard
Copied
Hi,
Thanks for your reply
Not sure what the calculate property is?
Copy link to clipboard
Copied
Instead of "this.delay" use "this.calculate".
Copy link to clipboard
Copied
Ok.
Would I put this in a button?
That would make the fields calculate but I need then to NOT calculate until I press the button.
How would I stop the fields from refreshing?
I am a beginner with javascript so what would the syntax be?
Copy link to clipboard
Copied
Brilliant!! Got it. I did 2 buttons 1 to turn the calculations off 1 to turn them on. Thank you so much.
Now, is there a way to automatically turn off the calculation with a document is opened?
That way I would only need 1 button to calculate the end page?
Copy link to clipboard
Copied
Yes, add the code to stop the calculation under Tools - JavaScript - Document JavaScripts.
Copy link to clipboard
Copied
Thanks to both.
Works. Only thing I am left with is when I click the button to switch back on calculation I then have to enter information in any field to make the document refresh and calculate all fields. Is there a sub command I could put in the this.calculate button that makes it calculate NOW.
Again, many thanks in advance, much appreciated
Copy link to clipboard
Copied
Yes: this.calculateNow();
Copy link to clipboard
Copied
Just wanted to say thanks again. Help much appreciated, especially for a beginner

