I have just converted from Notion a few days ago and I must say I am very excited be a part of this community. Although the formula side of things is a little daunting I am very excited to see if I can build ‘the fitness app of my dreams’ which I was forcefully trying to do within Notion but the UX simply isn’t as good as what Coda allows for via all of it’s insane functionalities. I am surprised I have never heard about Coda until a few days ago after stumbling upon a Coda template.
Anyways, I am currently working my Workspace and I must say I am very impressed (and overwhelmed) with the possibilities. So far so good but I have a bit of a formula issue I can’t get around without you guys!
Here it is:
I am trying to build a the functionality within my Tasks table that allows me add up all of the time I have spend on a specific task using the Pomodoro button I have created (I copied a timer template from within Coda’s templates). However the issue is that I have no idea how to build the formula I need to make this a reality.
Essentially what I am trying to do is:
Click the “Start Pomodoro button”
Timer column begins to count down
End column called ‘Total Time Spent’ adds up the time I spend in the ‘focus time’. (There is focus and break time - under the ‘State’ column)
When I click the ‘Take a Break’ or ‘Reset’ buttons, the ‘Total Time Spent’ stops adding up the ‘focus time’
The reason I want to see the ‘Total Time Spent’ on a task is because I want to be able to track the time I spend on each task as I do them and then be able to see all of this data in graphs/pie charts. But that’s a problem for another day
Thanks for reading, thanks for the amazing community and can’t wait to interact with as many of you as I can!
So, I’ve modified a “little” bit your sample doc (Thanks for sharing ) which I think should (maybe somewhat) do what you asked …
But, given this requirement:
It got a little bit more complicated … As going there directly allows to do this …
… a bit more purposefully
So, what changed in your doc ? :
Well, I’ve added a text field to store the row Unique ID where the task sits simply because if you want to track the time spent on a task, the tasks you track should be absolutely unique and using their names or other properties might lead to unnecessarily complex formulas or unexpected results if you have multiple tasks with the same names .
Then, I’ve added a table called [Focus Sessions Logs] to store all the focus sessions for a specific task.
The table is populated and/or modified by your buttons [Start Timer] and [Reset Timer] if necessary.
I’ve adapted and commented the formulas in these buttons trying to leave you some info about what they do exactly, hoping it would help .
But just in case, what the button [Start Timer] also does now is adding a row to the table [Focus Sessions Logs] with various info about the task when a session starts and when pushed a second time because you’re taking a break, it timestamps the end of the focused session started earlier .
For the [Reset Timer], when pushed, it will only timestamp the end of a focus session if there’s currently one… If not, it won’t do anything
As for the [Total Time Spent] field, if there’s a focus session currently occurring, it will display how much time has passed since the beginning of the session (which is optional or could be modified)… In any other cases, it displays the effectively total time spent on the task sitting in the row .
This should allow you to gather datas about your tasks, creates charts (and/or others), etc… in the future …
Note that depending on how you want to manipulate your tasks (create them, store them, archive them, etc…) you could also use Relation/Linked relation fields to link them where and/or when needed to what they could be linked ( ).
You could also store the task statuses and the statuses of your Pomodoro timer in their own tables as it’s always easier to modify these types of things when they’re stored in their own table (as you would use a row reference in your formula, meaning that when a row is updated in the table, all the formulas using the row will be automatically updated too) than having to modify each formula where you used these to keep the formulas alive and working (as if you modify the Pomodoro status "break" for example, everywhere you used something like thisRow.State="break" you would also need to update the formula with the updated status because the text values won’t match anymore)
A little something about Now(): Be careful with its use .
Now() lives in your browser and in this case (as it uses its default precision set to “second”) , is recalculated every seconds when used in a live formula, meaning that Now() can become a burden for a doc which might get slow …
As long as Now() is used within a button, it shouldn’t be a problem because it will only calculated when the button is pushed but elsewhere, that could be another story …
At least, that how it worked the last time I checked
A possible workaround I didn’t put in place in your doc could be to store Now() somewhere else in your doc (in a named canvas formula for example) and re-use that value where and when needed (as in that case, it’s only recalculated once, still every second but just once).
You could run some tests while using the Debug calculations tool to see what would be the best way to use Now() considering what you’re trying to accomplish with your doc (as well, sometimes, you just can’t avoid using Now() )
You’ll find the Debug calculation in the Settings of your doc, specifically in the Doc map menu where at the top, you can click on the 3 vertical dots (⋮).
It will open a dropdown where the only option available is Debug calculations .
My goodness! You are an absolute champ Pch!!! (no pun intended )
I must say you the amount of effort you have put into explaining everything for me is just overwhelming ly nice of you, I can’t thank you enough. Let me buy you a virtual coffee or something! You’re the friggin man!!!
I’ll have a go at putting this together in my master doc and will update you when done here with the final results.
I have updated my Master sheet and it is all set up as you have designed it!
Thank you so much again Pch
A two more questions for you Pch, I’m trying to figure out right now are:
Can you code a sound file so that it activates at the end of each focus/break timer?
Is there a way that the ‘Focus Sessions Logs’ can automatically log the ‘Area/Resource’ and ‘Projects’ relations that are within each Task’s rows? - I need it to do this so I can begin to generate graphs and analytics (no idea how I’m going to do this lol).
Thanks for the compliments and I’m glad to know this helped you a little !
Sorry for the late reply though but to answer your questions :
I think our Coda High Wizard @Paul_Danyliuk did something like this when he built a pomodoro tracker during a livestream but I don’t know if the livestream is publicly shared or not as it was posted on his Patreon some time ago …
So my answer here would be that it’s not natively implemented by Coda (and it would be a nice little add-on ) but, using Paul’s Trick (which might involve some Black Magic … I don’t remember ) there might be a way (but I honestly didn’t look at this, sorry )
Yes, using Relation/Linked relation and related columns fields …
I’ve had some fun re-creating the doc you shared in your initial post and mixing it with the sample doc @Math_24 shared earlier for 2 reasons :
Well, as the purpose of the pomodoro technique is to focus on one task at a time, storing the “Timer” in its own one row helper table makes sense
In terms of performances, I think using a one row helper table to store the task to track and the timer, then deleting it when done might help a little
(As the timer relying on the use of Now() is limited to one row it should also limit the recalculations while the timer is running… and when done and the row can be deleted, the timer shouldn’t calculate anything as there would be nothing to do so … vs. having a timer for multiple tasks still checking if they should use Now() or not)
I’ve added descriptions to most of the fields in the sample, commented some formulas (mostly the Action formulas I think ) and left an “About” page with some info . Now() is also stored in its own table and page and you should find it in the “Data” section …
I wanted to thank you for your concise and helpful explanations! Your work is so impressive and well-detailed
Regarding the sound file implementation, I will have to message @Paul_Danyliuk to see if he can help me with that
I’m still new to Coda, so I tried using related column fields but it didn’t work.
You were right about the Timer helper table, it really helps to focus on one task at a time. I also understand how you created the Now() table, and it makes total sense now - the checkbox is what starts and stops it, which is activated by the buttons.
Your work is too good not to use, so I will have to take your ideas and apply them to my Second Brain master tasks table
I also have a big project that I will be working on in the foreseeable future, which is a Coda fitness app unlike any other. The purpose of this app is to allow any beginner to start their fitness journey using planned training and nutrition programs, learning, and systems. I began designing a similar app in Notion last year (I can send you a link if you’d like to see it), but Coda is much more user-friendly and dynamic
If you’re interested, I would love to hear your ongoing input as I build it. I’m sure I’ll get stuck a lot, so any feedback and advice on how to build it the way I need would be greatly appreciated!