Question for the community: what’s the best understanding of when Coda recalculates formulas - especially those that are filtering/looking up tables?
Right now, I have one large table (Clients) looking up another large table (Meeting Notes) based on whether those meeting notes include that Client in a “Linked To Client” column OR whether one of those Clients’ Projects is included.
Right now, whenever I create a new Meeting Note (linked to anything, or nothing at all) it recalculates 100s of rows worth of lookups to accomodate this new addition, which - according to the performance debugger - takes upwards of 5 seconds per calculation. The thing is, I don’t need this information constantly recalculated across every single Client all the time: I only really need this lookup to occur when I open that client row, or view it in a detailed view.
Generally, that column is hidden unless you have the row open, and - as far as I can tell - there are no Modal’s that display that view either on any of the pages I’ve tested on. Is there a best practice on how not to trigger computationally intensive formulas until they affect a view?
Hey @Billy_Jackson! We have a detailed dependency graph that determines when things recalculate. If a value changes that your formula is dependent on, the formula will recalculate. If another formula is dependent on that first formula, it will also recalculate.
If you want more control over when things calculate, one option is to use buttons. e.g., instead of a column
Linked Clients having a column formula that is
=SomeExpensiveCalculation(), you have a button on each row, like ‘Update Client List’, that sets
LinkedClients to the result of
SomeExpensiveCalculation() Then whenever you open a row, you can just click the button and only recalculate that one row. An additional step could even be to setup an automation to push this button for all rows every hour or so, to avoid the need to manually push it.
Our CEO Shishir has a handy page here that details how to replace complex formulas with buttons that I’d definitely recommend checking out
Thanks @Jasmine_B, exactly the kind of info I was looking for!
With regards to the dependancy:
Does a value change ALWAYS trigger a dependant formula’s recalculation, even if that formula is neither A) present on the current page/view nor B) in the dependency graph of anything on the current page/view?
We have some optimizations in place to try and defer calculations until needed, like in the situations you mentioned. They might not take effect depending on the complexity of the involved formulas, though, and shouldn’t be relied on directly.