Hi all, I’m hoping some Dataview experts out there in the community can help with with a Dataview query.
I have a query in my Weekly Note template (using Templater as well) to roll up everything I’ve listened to, watched, read, or viewed during the week. The query in the template looks like this:
table without id
file.link as Work,
Tags as Type
where contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 0, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 1, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 2, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 3, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 4, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 5, tp.file.title, "GGGG-[W]WW") %>]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[<% tp.date.weekday("YYYY-MM-DD", 6, tp.file.title, "GGGG-[W]WW") %>]])
sort file.mtime desc
In this week’s Weekly Note, for example, this renders as follows:
table without id
file.link as Work,
Tags as Type
where contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-09-26]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-09-27]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-09-28]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-09-29]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-09-30]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-10-01]]) or contains([Date-Listened, Date-Watched, Date-Read, Date-Viewed], [[2022-10-02]])
sort file.mtime desc
The way this works is that in every album note, movie note, book note, etc. in my vault, there is an appropriate metadata field called “Date-Listened”, “Date-Watched”, “Date-Read”, etc.; and any day that I listen to a full album, watch a movie, finish a book, etc., I add the current date as a value in that field. The query above works fine; however, it is extremely long and repetitive, and I figure there must be a more concise way to write this. I’ve tried writing it a few different ways, but I haven’t found anything else that works.
I’m looking for a more concise version especially because I want to add a similar query to my Monthly Note, where writing it this way would get quite unwieldy.
Any help with this is greatly appreciated!