Help with Dataview Query: Get all files that are ingoing but not outgoing to create MOCs

Hey all, I need some help with dataview :upside_down_face:

In file A, I want a query that shows me all links going to this file, e.g., from files B and C. But this query should only show files that are not linked from A. Let‘s say I have a link to [[B]] in file A and a link in file A to [[B]] but not to [[C]], the query in file A will only show file C.

I tried this and other things but failed miserably:

LIST FROM outgoing([[A]]) AND ![[A]]

I looked up the dataview documentation and found the file.outlinks and file.inlinks as well as the contains() and filter() functions. However, I just can’t get it right…

What I am Trying To Do

Basically, I am „reading backwards“. When I read a paper, I create notes like [[Process A influences process B]]. Then I want this note to link to a MOC, e.g. [[MOC - A]]. In this MOC I want to query all files linking to it (ingoing links). Using this query, I add the links back to the respective note but sorted by topic/category. E.g., under the heading “## Important processes”, I would add [[Process A influences process B]]. However, this process can get messy with Obsidian’s built-in backlink feature because it fills up with links that I have already added to the MOC. I seek a way to only show the notes linking to the MOC and which have not yet been linked back to from within the MOC. So, if I add the link to [[Process A influences process B]] to the MOC, I want it to disappear in the query.

Hope this is not too confusing and thank you very much for your help! :smile:

1 Like

I think you want essentially the opposite of your example query. Documentation says

all pages which link to [[note]], use [[note]]

LIST FROM [[A]] or LIST FROM [[]] gets you the links going to A or going to the current file, respectively.

So to get links going to the current file but not from the current file:

LIST FROM [[]] AND !outgoing([[]])

Good luck!

Try this:

```dataview
LIST FROM ([[note.title]])
WHERE file.name != this.file.name
SORT file.name
```
1 Like

You are right! Thank you very much for the quick help :smiley:

1 Like

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