I am trying to write a query on Dataview that will give all secondary in-links to the current note. By secondary in-links I mean links that are in-links of an in-link to the current note.
Is it possible to do this at all? I’ve searched in all the dataview showcase thread without any success.
Thank you SO much in advance for any help.
Yes, it’s possible.
What’s your start query?
Hello, thanks for your reply.
I’ve tried many variants of this:
WHERE contains(this.file.inlinks(file.inlinks, file.link), file.link) and !contains(this.file.outlinks, file.link)
I am certain it must be a no-brainer. I would just be happy if I could know where to look in the documentation in order to use the syntax correctly (I am a total beginner!)
Thanks in advance for any help!
Docs gives you the generic syntax, commands, functions, …, and the logic. It’s a toolbox (a language) to apply and adapt according our goals (if possible).
So, you can use multiple approaches.
- For example, in dql we can “index through” links to get values on the corresponding page. This means, for example, we can start with the current file inlinks and target their own file inlinks:
\\ inline dql query to target all inlinks to the current note
\\ inline query to index through (in)links: get the value of "key" in these files
\\ inline query to index through (in)links: get the inlinks in these files
- But we can apply another logic: define as source all the inlinks to the current file and then call the inlinks of that files:
As you can read in docs, you can define in
FROM as source the links TO current note (the inlinks) or links FROM (the outlinks). In case
FROM [] means “define as source all the files linked to the current note”.
So, if you want a “clean” list, you can use this kind of DQL query:
LIST WITHOUT ID InLinks
FLATTEN file.inlinks AS InLinks
Or this dataviewjs inline query:
Thank you so much for the exhaustive and super helpful answer. I am going to go through all your suggestions (it might take me a while because I have to get acquainted with the language, but I have already tried a couple of your options and I’m positive I’ll get what I’m looking for after a couple of tinkerings. Thank you again!