Updating older notes

Things I have tried

cmd+shift+I to open up the console
(it looks scary and I don’t want to mess anything up)

What I’m trying to do

i am trying to write a script or (something, sorry coding newbie) that will update notes in a specific folder where date <= this.file.day to a specific template when run.

For instance, with Daily Notes, I modify the template frequently as I modify my routine. Every time I update the template, I’d have to manually go through each note and insert “new section or feature”.

I am unsure what or where I should look into for creating/testing it. I am new to coding and have a general idea of the script logic but writing it in the correct syntax is difficult. Any suggestions?

I’ve seen some requests on this topic lately, and in general I think one needs to rethink the use case. I think one needs to allow the daily template to evolve without going back in time and retro fit the template to old notes.

Imagine yourself a few years in the future after diligently writing your daily notes, were you suddenly decides to split a section into two. Is it then feasible to change all previous notes to have that split?

I believe it’s better to leave the older notes as is, in most cases, and rather think carefully when and how to change the template if it impacts other parts of your vault.

In general, it usually means you need to look at weekly and monthly templates, so the change should occur in the start of a new month or a new week. Possibly some care should be taken if it affects a yearly note, but that could often be handled manually.

Back to your original question, coding does require some practice, and changing multiple notes is not for the faint of heart. I’m a programmer by profession, and I’m reluctantly wanting to do any changes to multiple notes if I can avoid it, due to the many possibilities for it to go wrong somehow.

If you still want to pursue this path, please do make a copy of your vault to play around with. That way you won’t change your real data before you’re fairly confident your script works as intended. And even then, please do make backups of the real vault before you run your script. Code has errors, and you’ll need that backup every so often.

1 Like

@holroy Thank you very much for your response! I totally understand where you are coming from and appreciate that sort of reasoning.

I’m asking for a vault specifically dedicated to my PhD work so integrating new features in any template that i make (equipment notes, daily notes, mtg notes, etc…) can be consistent across them all.

specifically, for daily notes, I created a section that has a dataview block to list notes created AND modified that day (of the daily note); going back to any of the previous daily notes and adding this feature would be extremely helpful when I refer back to work I did that day.

I will play around with it – maybe – and be sure to make redundancies of my vault just in case! haha thank you!!

So if you modify the next day it’s uninteresting? Or if you type it a few days later, since you were too busy that day it’ll look like you created a whole lot of notes when you catch up again?

And will you actually go back to your daily notes for that information, or would it be just as good to have a dedicated list on changes related to your PhD where you list/sort according to creation and/or modification time?

Anyways, enough of the negativity, and let me just say that I would strongly suggest to invest some time into making a dv.view() instead of inserting queries into your daily notes. That way, the view can be updated in the future and all notes using that view will benefit from it.

You might even use one or two extra calls to dv.view() to be decided upon later. (Think header/footer stuff) That way, if you down the road decide that this would be ingenious to have included in daily notes for both past and future notes, you’ve got a place to add them.

And lastly, if you include a (preferably hidden) tag/field in the newest insertion, which should be done through the use of a template, you could make a query to list daily notes not having the insertion. This would allow you to chip away at those daily notes lacking the insertion, and not be overwhelmed doing all at once.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.