First post. Let me start by saying I am so greatfull to the people who have generously posted their ideas, and to the team who makes Coda. I can’t imagine making the tools I am using everyday at work now any other way.
The short version; should you try to build iteration into a single action, or is building the thing you want to iterate through once first a better way to handle the complexity?
Slightly longer exploration:
I made a calendar scheduling doc. It stores all these calendar events and created Googlecakendar events in parallel, and even let’s me update the Gcal events from Coda with changes I make from the Doc. It’s great. But it’s also hundreds of rows and the whole set of data is changing a lot. I wanted a way to backup entries as they changed.
So I got this idea to back up rows by writing to a “Log Table”, and do a simple comparison between the log and the current data to figure out which rows need to be archived; just compare the modified date in the original with the date of its log. If they don’t match, I need to grab the row. And I check if new items need to be logged by comparing all the log dates and the current data’s modified dates. So far so good.
But then I realized to write the rows, I needed to iterate. I wanted to write one row for each item that needed be recorded. And after working with a situation where I wanted to iterate before, I heard about the trick to use sequence() and use the numbers in the sequence to iterate through a list for you. But as I tried building it, I realized there was another I could accomplish the same goal without needing sequence.
- build one button to update the next row that needs to be logged
- build a button that counts how many updates need to be made, and push the first button that many times
- disable the second button if nothing needs to be logged.
The reason I am posting here is I am about to set up a bunch of these to create running logs of most of the important data in my doc. And if I am going to be running this process hundreds of times, I wanted to see if anyone else has come across this sort of things and how you dealt with these sort of workarounds when it comes to iteration.
My button to iterate looks something like
Runactions(
Formulamap(
LogOfTable.filter(Data.modifiedDate!=modifiedDateLog), PushTheButton))
And the single update
Addrow(Log, dataColumn1, Data.filter(modifiedDate!=modofiedDateLog).first().dataColumn1, ect ect)
It’s a lot of adding rows no matter how you do it, but I am curious if there is any benefit in writing it out into a single button that can iterate once per entry to log, or if this work around is a viable alternative.