blacksmithgu / obsidian-dataview

A data index and query language over Markdown files, for https://obsidian.md/.
https://blacksmithgu.github.io/obsidian-dataview/
MIT License
6.94k stars 411 forks source link

Dataview shows all tasks on a page, rather than only the ones specified in the query #2256

Open RebeccaCotton opened 7 months ago

RebeccaCotton commented 7 months ago

What happened?

I have a page with multiple task lists. Screenshot_20240301_160645

When I create a dataview for one of these lists, then the Dataview returns all tasks from that page, rather than only the ones belonging to that specific tag.

Screenshot_20240301_160821

Expected behaviour would be that the query only returns the todos from that specific tag, Similar to how the Checklist Plugin works: https://github.com/delashum/obsidian-checklist-plugin Screenshot_20240301_161226 So in my example only the task "project B" should appear in the list specified in the query

DQL

task from #todo/Business  
where !completed

JS

No response

Dataview Version

0.5.64

Obsidian Version

1.5.8

OS

Linux

holroy commented 7 months ago

When you specify tags outside of a task definition it's applied to the entire page, and not specific to that task. This means that when you do a task query like yours where you're asking for tags related to a particular tag it'll list either specific tags related to that tag, or all tasks from pages tagged with that tag.

In order to make the tag related to the task it self you need to do something like:

- [ ] project B #todo/Business

There are also two other methods to do this, and that would either to only have business related todos in your entire file, and keep the #todo/Business tag, or potentially you could also limit your task query to a particular section of your note:

## Business

- [ ] project B

... Further down or in another note ...

```dataview
TASK
WHERE meta(section).subpath = "Business"


In either case, this is not a bug, but more of a misunderstanding on how to tag tasks.