Trying to make a Yearly tracker page

What I’m trying to do

I am trying to create a dynamically updating table to capture my various media consumption throughout this year. I’ve often looked back and thought “what did I even do/play/read/watch in the last year?”, and I am hoping to use data to solve that answer that question this time.

Things I have tried

My current setup is that I have the following folder structure, and intend on creating files in each of these for individual entries

Media

  • Games/
  • Moves/
  • Shows/
  • Books/
  • Graphic Novels/

I am not tied to this (I was initially trying to use tags, but was struggling to parse something like #games/NAME and #books/NAME)

I’ve had a few false starts with dataview in getting this information out, largely by listing the files and then counting backlinks (this seems like its a good work around?), but none of it is really getting me all the way there. Ideally, what I’d want is a large table, with subtables for each media time, and entries on those tables for each piece of media, and a count of days I engaged with it. This allows the whole thing to be dynamic, letting me add new types of media as I go, if I want to be more specific at some point or other.

dataview
list rows.file.link
from "Media"
group by file.folder
dataview
table without id file.folder as "Type", file.link as "Name", length(file.inlink) as "Count"
from "Media"
dataviewjs
dv.list(dv.pages('"Media"').file.folder)

Thanks in advance, and I look forward to your insights.

If anyone is interested, I’ve gotten a lot closer with this

dataviewjs
for (let group of dv.pages('"Media"').groupBy(p => p.file.folder)) {
  dv.header(3, (group.key).split('/')[1]);
  dv.table(["Name", "References"],
  group.rows.map(k => [k.file.link, (k.file.inlinks).length]))
}

The one thing I have yet to sort out is how to only count the inlinks from this year.

I think I need to do some kind of filter or reduce on k.file.inlinks, which is the next thing I’ll be digging into.

I’ll continue to post updates, but if anyone has suggestions, I’d appreciate them.

One suggestion is to use the creation year of the note with the link to limit to last year.

And one bonus tip: Enclose markdown or queries in four backticks, to show for the entire code block to show.

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