Im trying to only returns the files that have matching outlinks to the inlink of the file the query is in. Instead im getting all the files regardless of out-/inlinks that are in the specified path.
Hmm maybe I am not understanding this correctly, but in my eyes it doesn’t look like I’m duplicating anything.
Tasks don’t link to the Project, the file that the query is in.
Tasks links to phases and phases point to projects.
Task → Phase
Phase → Project
file.inlinks for Project will be Phases while Task file.outlinks will point to Phases.
Your solution does work but it means I’ll have to add the phases to the query everytime a phase is added to a project, which is something im trying to avoid.
A solution I’ve been avoiding is to link or tag every tasks directly to the project itself but that feels clumsy.
Please feel free to correct me or ask if something is not clear.
Let me think about the solution - as I am a bit in a hurry, I possibly only will find the time for that later on. If noone else comes with a solution in the meantime, be patient a bit…
You are aware that your written file.oulinks in that query example?
Other than that, my experience with contains of lists in lists is a little varying. I tend to rather do a contains() in combination with either a map() or filter(), and then afterwards do any()/all()/none() depending on my criteria for success.
Here is a query (which hopefully works as intended):
```dataview
TABLE file.inlinks, file.outlinks, this.file.inlinks, matches, any(matches), all(matches)
FROM "Tasks"
FLATTEN array( map( this.file.inlinks, (il) => contains(file.outlinks, il) )) as matches
WHERE file.outlinks
```
What should happen is that we check each of the inlinks of this file, to see if they’re contained in the outlinks of the other file. This check is mapped to an array, matches, which we then can check on later to see if it has any() or all() values as true. In the query I list all values, so you should be able to see the behavior pretty clearly (if I’ve not done any typos as I’m on mobile).
I’ve also added a WHERE file.outlinks limit, as if there is no outlinks, then they’re not going to match any inlinks either…