I have Project notes in their own folder and more loose Area notes with which I tag the projects, in a separate folder.
I want to create a filter to fetch all active project notes that are “tagged” with a specific area
Usually, projects like ‘Write XYZ blog post’ or ‘Finish writing chapter X for book Y’ are tagged areas:: [[Writing]]. I’m currently manually linking to each active project manually in each area note, but I’m sure there’s a smarter way to do it. Ideally, the same snippet of code can be reused in any note based on its name, without me tweaking the filter everytime.
TABLE WITHOUT ID file.inlink AS "Projects"
FROM "4. Projects/1. Active"
WHERE file.name = this.file.name
SORT file.name
However, I’m not able to get it to work… I tried different formulas (I didn’t keep track of all of them tho, sorry about that) and ended up fiddling with this one, but it’s returning nothing (it’s not failing either)
since you tag the area note within your project note as a link i.e. areas:: [[Writing]] you should use this.file.link instead
also, you should try to match areas instead of file.name because of the bullet above. areas is the “key” which you want to find the matching “value” which in this case is [[Writing]]
the following dataview code is meant to be inserted inside your areas note. if you place it somewhere else, then you would need to replace this.file.link with explicit value like [[Writing]]
TABLE WITHOUT ID file.inlink AS "Projects"
FROM "4. Projects/1. Active"
WHERE areas = this.file.link
SORT file.name
Oooh! Now they show. Is it possible that it’s also finding files with no links to it?? I’m trying to test it, but I also get files with no links-- I’m very confused
Edit: providing example
I’m testing this on a page named Writing to find all the notes that link directly to it through that areas:: field. This is what I get, notice the strange formatting and uneven rows
So, it appears that the solution is to take out the WITHOUT ID file.inlinks AS "Projects" bit. The uneven spacing was caused by the missing key, which was the actual column containing the pages I was looking for
LIST
FROM "4. Projects/1. Active"
WHERE contains(areas, this.file.link)
SORT file.name