I have searched the forum and the Dataview website for a solution.
I have tried these codes
table file.link.informs
from ""
where informs
table file.link.informs
from ""
where informs
group by informs
table file.inlinks
from #concept or #themes
What I’m trying to do
In my vault I have concept files, tagged #concept, and theme files, tagged #themes. I also have many literature files which are relevant to these concepts and themes. These literature files are annotated with inline field informs:: [[name of concept]] or informs:: [[name of theme]].
I would like Dataview to show me in a tabular format all the literature files which link to each concept or theme. For e.g.
|File | Informed by |
---------------------------------------
|[[Motivation]] | [[link to literature 1]] |
| | [[link to literature 2]]|
---------------------------------------
|[[Media]] | [[link to literature ]] |
---------------------------------------
I hope the above clarifies what I am trying to achieve.
Hi.
To start, one question: in your table, you want in the first column all files (the source) that have the tags #concept or “themes”, right?
If so, the first step is the definition of the source (the “core” files).
Then, you want all files that link to these notes (backlinks / inlinks) or only the the backlinks which have the field informs with a link to the concept/themes notes?
For test purposes, start here:
TABLE file.inlinks AS Backlinks, file.inlinks.inform AS Inform
FROM #concept OR #themes
If you have backlinks from other notes (not only from the notes with the inform field, then it’s necessary to apply other filters… like WHERE contains(file.inlinks.inform, file.link).
Maybe you need other filter, but start here.
I just want to mention a small technicality. The filter, where contains(file.inlinks.informs,file.links), filters only the file.link. But it doesn’t filter the file.inlinks. Therefore, the inlinks displayed against the file.links contain both inlinks where informs exist and inlinks where it doesn’t.
So, you have a “File A” that contains an inlink (backlink “Back 1”) with the field informs linked to “File A”. This is the first condition.
But “File A” has more inlinks… and you want to see only “Back 1”.
To do that we have two options… but maybe this is the most direct: filtering directly in column declaration. Something like:
TABLE filter(file.inlinks.informs, (i) => contains(i, file.link)) AS "Backlinks"
FROM #concept OR #themes
WHERE contains(file.inlinks.informs, file.link)
Try it and tell me if it works (technically speaking).
The filter just returns file.link not the filtered file.inlink required. Or perhaps it is just returning file.inlink.inform which is also the same as file.link.
Of course… (without tests I mess up…). The filter order is switched:
TABLE filter(file.inlinks, (i) => contains(i.informs, file.link)) AS "Backlinks"
FROM #concept OR #themes
WHERE contains(file.inlinks.informs, file.link)