File.inlinks with folder exceptions

What I’m trying to do

I add to my knowledge base information about the films I have watched and the actors associated with these films. I have a separate file “Actors”, where using the Dataview code a table with data of the actors is displayed: name, date and place of birth, etc. Among this data are the films in which they starred. The idea is that these films will be notes-films that I previously created. I do this using file.inlinks.
However, I ran into a problem: I need to exclude the daily notes folder (Daily) from the mentions output. Now it looks like this:

Things I have tried

Here’s the code I’m using to output the data:

table without id
	file.link as "Actor",
	born as "Born",
	height as "Height",
	file.inlinks as "Movies"
from #movies/actors and !"Templates" and !"Daily" and !"Actors"
WHERE contains(file.folder,this.file.folder)

This assuming the file is inside the folder you want notes from. Remove FROM line and not use it, where is more efficient.

By the way specify the file tree of your vault can be helpful for people to provide the correct data view formula.

I keep all my notes in the root. I also use the “Daily” folder to take daily notes. In my daily notes, I actively link information to the notes from the / (root). So far, the formula that I use is the only working solution for me and where is not yet suitable for solving my problem.

When writing daily notes, I can insert the name of an actor and make it a link to a separate page. Dataview treats this as a mention of the actor, adding a daily note to the list of movies that actor has starred in. Here’s what a daily note looks like:

And here’s how Dataview processes information:

That is, all I need is to exclude daily notes from the results.

UPD: I could just remove the links from the daily notes, but I don’t want to do that :slight_smile: .

The issue is resolved. This is the final code:

table without id
	file.link as "Actor",
	born as "Born",
	height as "Height",
	filter(file.inlinks, (o) => !contains(o.file.folder, "Daily")) as "Movies"
from #movies/actors and !"Templates" and !"Daily" and !"Actors"
1 Like

In addition to the variant you’ve marked as your solution, it could also be done using properties to declare that the movies are actual movies (and/or to denote that the daily notes are just that, daily notes), and then add clauses to the query to exclude/include just notes of the given type.

This could be useful for example if you extend your information to also includes actors or figures being in both movies and books and … . With the note marked as a given type, you could then have dedicated columns for the various media the actor is present in.

An untested variant of the “Movies” column could then become something like:

filter(file.inlinks, (l) => l.type = "Movie") as Movies
2 Likes

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