Hi team, I am having trouble with the performance on a Timelogger that I built in coda.
I have a column called ‘Is last task’ which I use on things like buttons.
The usecase seems pretty simple.
IF this is the most recent task assigned to me THEN true()
However I noticed that is often taking 5+ seconds. I assume this will just get longer as the database grows. I had a read of Optimizing Slow Formulas but didnt find a solution
The formula I am using looks like this:
thisRow = [Time Logging: Database].Filter([Performed by] = User()).MaxBy(CurrentValue.RowId())
Does anyone have any insights on how to perform this check more ergonomically?
Can you give more context around the surrounding workflow and use case?
There might be a far better solve for you than simply optimizing a formula.
Sure, here is a bit of a breakdown of the feature this supports.
- Each ‘Time Log Row’ has a [Start Time], [End Time], [Duration], [Is Last Task] and [End Button]
- [End time] = [Start Time] + Duration]
- When [End Button] is pressed it calculates the time spent and inputs that into the [Duration] column.
- The [End Button] is disabled if [Start Time] and [End Time] have values and [Is Last Task] is false().
- This is because it is very common for a task to be ended, but then take longer. Hence the ‘End Again’ feature was built which is causing us a problem. IF [Is Last Task] then [End Button] label says “End Again +5m”. (For example if NOW() is 5 minutes greater then end time)
It is this [Is Last Task] that is taking 5 seconds each time it runs which is why I thought I would focus on it.
Does that help?