Skip to main content
Inspiring
June 15, 2020
Answered

on/off the automatic calculation of field values

  • June 15, 2020
  • 1 reply
  • 3686 views

I understand that I can turn on/off the automatic calculation of field values ​​in the Preferences > form tab. Is there a method to put this on a button in a form?

 

Normally I would like to leave it off and let the whole calculation happen only once when the button is pressed.

This topic has been closed for replies.
Correct answer try67

This code by itself doesn't make much sense, no. Do you want the button to toggle the automatic calculation?

If so, use this:

this.calculate = !this.calculate;

if (this.calculate) this.calculateNow();

1 reply

try67
Community Expert
Community Expert
June 15, 2020

Yes, you can do that by setting the value of the calculate property to true or false, like this:

this.calculate = false;

this.calculate = true;

However, keep in mind the enabling the calculations does not cause them to actually happen.

If you want to do that you can do so like this:

this.calculateNow();

Inspiring
June 16, 2020

Thank you! And thank you for your prompt reply also. I went to bed after writing this question. sorry.

 

I wrote the following 3 lines of code in the created button.

this.calculate = true;
this.calculateNow();
this.calculate = false;

Is this working correctly? Should there be a wait between lines 2 and 3? If so, is there a method for that?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
June 16, 2020

This code by itself doesn't make much sense, no. Do you want the button to toggle the automatic calculation?

If so, use this:

this.calculate = !this.calculate;

if (this.calculate) this.calculateNow();