Filter list on file location of linked property

What I’m trying to do

I have a bunch of notes with the property “source”. For each note the value of source is a link to a pdf document. These pdf documents are stored in a variety of folders, based on the date it was written.

In a separate note, I want to make a simple dataview list of notes, who’s “source” property has their pdf in a particular folder.

So let’s say I have files A.pdf and B.pdf in folder 2022 and files C.pdf and D.pdf in folder 2023.
Note 1 has source: A.pdf, Note 2 has source: B.pdf, Note 3 has source: C.pdf and Note 4 has source: D.pdf.
Inside a note called Note 5, I want to create a list of notes that have their source pdf in folder 2022. In this example that would mean that notes 1 and 2 would show up in the list and notes 3 and 4 wouldn’t.

Things I have tried

I’ve to use the dataview List function with a “where” statement trying to obtain some kind of path information from the property “source”, but to no avail. Perhaps it’s not doable?

I think you’re going to need to get into DataviewJS for this. It’s all definitely possible, but it’ll require working with arrays and using dv.pagePaths and regex, and stuff.

It MIGHT be easier to simply add metadata for the year that applies to any given note. I’m guessing the PDFs probably don’t move around in folders much, given the year classification. Or is the example problem you’re presenting super abstracted and you have a much more complex classification that would be annoying to change all the metadata for?

Given a link you can use meta(...) on it to get the various extra information, like the path. See Functions - Dataview for more on what’s available.

1 Like

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