What I’m trying to do
Hello! I’m trying to make a dataview to search through all of my weekly notes (tagged #weekly) for a given month for times where I define “event”.
I have examples for my weekly notes (searching through #daily for the week) and my yearly notes (searching through #monthly for the year), but haven’t figured out how to get it working for my monthly notes yet.
Searching through #daily for the given week:
TABLE without ID
file.link AS "Daily Log",
dateformat(file.day, "EEEE") AS "Day",
event AS "Details"
FROM #daily
WHERE event != null
AND event != ""
AND file.day >= date(<% moment(tp.file.title).startOf('isoweek').add(-1, 'day').format("YYYY-MM-DD") %>)
AND file.day <= date(<% moment(tp.file.title).startOf('isoweek').add(5, 'day').format("YYYY-MM-DD") %>)
SORT file.name ASC
Searching through #monthly for the given year:
TABLE without ID
file.link AS "Monthly Log",
event AS "Details"
FROM #monthly
WHERE event != null
AND event != ""
AND contains(file.name, "<% tp.file.title %>")
SORT file.name ASC
The overall goal is that I want to push logged events from my daily notes to my weekly notes. From there I’ll re-log events I consider more important and push those to my monthly notes, and from there I’ll re-log them to push to my yearly notes. I also want to use whatever the solution is in order to push weekly summaries to my monthly logs.
Things I have tried
So far I’ve only managed to have the dataview search through my #daily notes accurately, using these:
AND file.day >= date(<% moment(tp.file.title, 'YYYY-MM').startOf('month').format('YYYY-MM-DD') %>)
AND file.day <= date(<% moment(tp.file.title, 'YYYY-MM').endOf('month').format('YYYY-MM-DD') %>)
.
I’m guessing the solution might involve using the following Templater string, or something similar:
<% moment(tp.file.title, 'YYYY-MM').startOf('month').format('gggg-[W]ww') %>)
But I’m not sure exactly how to use it for my intended purpose, as that and the endOf version of the Templater string only grabs the first and last week of the month. The problem would be getting the weeks in-between.
Any help would be appreciated! I’m pretty sure I’m missing a simpler solution here.
Date formats
Daily: YYYY-MM-DD
Weekly: gggg-[W]ww
Monthly: YYYY-MM
Yearly: YYYY