Skip to main content
Inspiring
Jun 15, 2020 7:36 PM UTC
Answered

on/off the automatic calculation of field values

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Jun 16, 2020 8:08 AM UTC

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();

4 replies

try67
Community Expert
Community Expert
Jun 15, 2020 8:50 PM UTC

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();

Translate
Inspiring
Jun 16, 2020 7:53 AM UTC

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?

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Jun 16, 2020 8:08 AM UTC

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();

Translate