How to avoid using Now() to reduce the calculation time of a Doc to check the hour?

I have a formula that should check if the time it’s before or after a certain hour of the day and according to the result pass a different value to an automatic message for an email body. It’s not a critical feature as I can quickly bypass it with a general greetings formula, but this poses me a problem if anyone have figured out how to check the hour without using the Now () functions that checks the time every second and it’s quite system resource intensive. My doc it’s growing very fast and the formula it’s been calculated on every single row of a big table.

Can i write anywhere in the doc the formula and than check against it? Does it reduces the calculation time? Does anyone else have found a workaround for that or could suggest a syntax?
Thank you!

1 Like

Hi @GiacomoPasini you can accomplish this with creating a canvas variable:

Now Minute =DateTimeTruncate(now(), "minute")

This will update every minute and require minimal resources. Good luck building!

3 Likes

That’s a brilliant solution! Should I use hour instead of minute will it be less resources too. For me if it’s 17:59 or 18:59 rounded to the very next our it isn’t an issue at all as all I need is to pass a Good Morning, Good Afternoon and Good Evening on an email body.

I think Coda might still see that a calculation was made with that variable and still trigger re-calculation of other formulas using it. The best bet to guard against this sort of dependency is to rely on a value that is written to a cell instead of one that reacts to a formula.

Here is an example you can try:

4 Likes