Hi, I’m trying to list notes from folder without second level backlinks (“categories”).
I think I need something like “subquery” or “SQL like join” in DataView.
My structure notes (connected by links) in folder: Root note → category notes (every category links to Root) → notes in categories (every note links to category note). And “orphan” notes (without link to category) in the same folder.
I can list tree (notes in categories) in Root like that:
It works with this simple example (when notes are empty). But it doesn’t work when notes contains link to any other note.
I need in WHERE clause specify only “categories” (backlinks to “Root” note), in this example: “Animals”, “Food”.
Pseudocode:
dataview
LIST
FROM "Folder"
WHERE "not contains link to any categories (backlinks to Root - `this`)"
I know I can get “categories” like that file.inlinks from [[]] or contains(this.file.inlinks, file.link), but I don’t know how to write first part “not contains link to selected notes”.
Try the DQL02, which is based on your original input.
Summary
DQL02: get a note which is not refered exclduding the current file
```dataview
LIST
FROM "Folder"
WHERE file.name != this.file.name
WHERE (
none(file.outlinks, (o) => contains(o, this.file.link)) AND
none(file.outlinks, (o) => contains(o.file.outlinks, this.file.link))
)
OR (length(file.outlinks)= 0 AND length(file.inlinks) = 0)
```