Dataview newbie - how to find files that are NOT included

I have read the Documentation (think I found the correct section but didn’t understand the implementation) and searched here, but am still lost sorry

In theory all my Obsidian files/notes have at least one MOC link in the Backlinks heading, as shown. I’ve just got the hang of Dataview so I have my lists of files under the different MOCs, for example ‘Digital MOC’ or Obsidian MOC.

image

Now I would like to use Dataview to show me any files where I forgot to add an MOC in the heading, so pages without any MOC link.

This is the best I could think of :pleading_face: I should add, I don’t use any Properties
image

I’m sure it’s a very simple answer but I can’t figure it out, thanks!

In order to help you negate any file lists we also need to know how do you distinguish your MOC files from the other files. The query you’ve presented limits to files not linking to a note called MOC.

Thanks Holroy

I’ll answer as best I can. I keep all my MOC’s in their own folder called MOCs (all my other working files/notes are in folder General Notes).
Apart from that all my MOCs are called [[Addiction MOC]], [[Anthropology MOC]], [[Biology MOC]], etc.

As I showed in my first screenshot, for every note I use the Template, starting with the Title, then date, then have attempted to consistently connect the file with whichever MOCs it belongs under.

Thanks for looking :grin:

I’m not certain what kind of syntax you’re using with that text, since it doesn’t seem to be properties nor inline fields. So based on the assumption that you’re looking for files not linking to a file ending with MOC.md, you should be able to do something like:

```dataview
TABLE atStart, anyWhere, atEnd
FLATTEN list(filter(file.outlinks, (out) => icontains(out.file.name, "moc"))) as anyWhere
FLATTEN list(filter(file.outlinks, (out) => endswith(lower(out.file.name), "moc"))) as atEnd
FLATTEN list(filter(file.outlinks, (out) => startswith(lower(out.file.name), "moc"))) as atStart
WHERE length(anyWhere) > 0 OR length(atEnd) > 0 OR length(atStart) > 0
```

The script as it stands would list all files having an outlink where the file linked to has moc at the start, in the middle, or at the end.

In theory, your query should then be achievable using any file where atEnd actually is 0. So maybe the following would work:

```dataview
LIST
FLATTEN list(filter(file.outlinks, (out) => endswith(lower(out.file.name), "moc"))) as atEnd
WHERE length(atEnd) = 0
```

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