I’m trying to create an automation to push a button every first monday of every month (example: 2th of November, 7 of December, etc)
@Alice_Ly was super helpful and created this formula:
Formula name: “First Monday of Every Month”
This shows the date of the first monday of the current month, so then I can create an automation: If Today = First Monday of Every Month , then “Click Button”.
I think it works, but is anyone else doing something similar?
Special thanks to @BenLee
As I stated in topic that @Mario linked, I really wished Coda had some more support for operations with months (both automation and formulas). As is we are forced to write some complex formulas for some pretty basic stuff (like my example of counting number of months between 2 dates or OP-s formula to run automation each month). Good thing is there are workarounds for this, since Coda does have some powerful formula tools, but there is so much room to make our life much easier for this basic stuff
Yes @Marko_Petrovic, dates and times still have their speed bumps. We hear you on this, it’s just not part of a project at the moment, but we will look into this at some point.
I also brought this up in a few other channels and there were a few more solutions posted…
From @Saul_Garcia and using a creative
Today() - Today().Day() + 1 to find the first day of the month…
And @Paul_Danyliuk reminding us all that
Today().DateTimeTruncate("month") exists and will give the first day of the month as well…
Here’s a more concise and performant way (one calculation instead of seven checks) to calculate first Monday of the month relative to the date.
.DateTimeTruncate("month") to get the first day of month,
- Figure out how many days are there till the next Monday using this formula:
thisRow.[First day of month]
+ Days(Remainder(9 - thisRow.[First day of month].Weekday(), 7))
9 - Weekday because Monday is 2, so
Remainder(7, 7) would calculate to zero days required to add.
@BenLee Thank you for the answer and some potential solutions. I hope date/time formulas, especially concerning months, will be improved at some point like many aspects of Coda are every month, it will make our everyday life much easier
Also I have to thank @Paul_Danyliuk for his contributions, I alredy used his formula to calculacte number of months in a date range, it helped a lot
If we just need to trigger an action the first Monday of the month (vs. enumerate all first-Mondays), isn’t it as simple as adding a Time-Based Rule to run on Monday and then a check if it is the first 7 days of the month:
(Still learning my way around, so may be missing something obvious and happy to understand use-cases where this doesn’t work!)
hi @Tim_Burns1, thanks for the suggestion. I guess you tried it out?
It is indeed an easy set-up, done in a few minutes. My steps in line with your suggestion:
- put the day on today (it is Saturday for me)
- put the time on 11h AM (the nearest full hour in my time zone)
- ask for True() via IF using:
- Linking it to a checkbox in a table with an easy to remember name
- I closed the doc in the browser (the most likely use case)
- and then wait and see.
Well the result is: it worked
Thanks and enjoy your day!, Christiaan