If I read your request correctly you’re asking for a task query listing all tasks where none of the outlinks of that tasks goes to a note within "Milestones"
.
In itself that shouldn’t be too hard, using a combinations of map()
and meta()
on the outlinks of the tasks. But there is a little bump in the road, and that is that the destination folder of a link is not given in the meta information on the link itself. However, doing a slightly more expensive test you could following the link, and list the file.folder
of that file.
An example showing this difference
I placed the following in a note:
- [ ] No link at all
- [ ] To [[Deliverable]]
- [ ] Link to [[Something]] else
- [ ] A link to something [[Non-existing stuff]]
- [ ] Link to both [[Something]] and [[Deliverable]]
```dataview
TABLE WITHOUT ID
item.text,
map(item.outlinks, (l) => meta(l)),
map(item.outlinks, (l) => l.file.folder)
FLATTEN file.tasks as item
WHERE file = this.file
```
Here the “Deliverable” note is within a sub-folder called “Milestones”, and the other notes aren’t in that folder. In my setup this resulted in this output:
Notice that I do use some trickery, aka FLATTEN
, to access each task in a table context.
This leads to the following query to check that none of the outlinks of a task resides within a folder ending with “Milestones”:
```dataview
TASK
WHERE file = this.file
AND none(map(outlinks, (l) => endswith(l.file.folder, "Milestones")))
```
Here I use file = this.file AND
to limit the query to just my test file. You should most likely exchange that with something to limit to your query to the relevant set of tasks.
You might also want to do something like l.file.folder = "My/Path/To/Milestones"
or some other match to limit to your destination folder.
The crucial part of this query is that it map()
's each of the outlinks
of the tasks, into a single entity l
, where we then do the match against its file.folder
parameter. This produces a list of matches, where we’re only interested in the task if neither of the outlinks matches against our folders, so therefore we add a none()
around the entire list produced by map()
.