Query all checklists or tasks by tag within a code block

I’ve searched far and wide and I’m not sure if I messed up my plugins setup or what because this should be simple. It certainly looks that way from this tutorial (9min mark)

I have a main page where I track TODOs, which I have separated into blocks with a unique tag (#todo/TYPE-OF-TODO). I installed the Checklist plugin and left the #todo default global keyword.

It looks like this, and I do have newlines separating the blocks


  • [ ] do this
  • [ ] and this
  • [ ] and this, too


  • [ ] something else to do

I see tasks separated by tag in the sidebar, so I think Checklist is doing what it’s supposed to.

I want to, in another page, grab all of the tasks for a given tag, even if they don’t come from that main TODO page. In the tutorial, and using Dataview, it seems the query should be (imagine I am closing the following code block with ```)

``` dataview
TASK FROM #todo/project-name

That’s pretty and simple. But what happens to me is that all tasks get pulled in, seemingly ignoring the tag I specified. My guess is that the query grabs every task on a page because the tag exists there.

But I only want the tasks within a block. Is this functionality not available? Seems like it should be based on that YouTube tutorial.

I found this solved question, which specifies a page and uses WHERE contains(tags,"todo/project-name") which returned an error message. I also tried using contains(text) per this other solved question which also didn’t work. They seem to be looking at the text for each task, anyway, instead of the block they are in.

I tried using the native query language from this question and did block:("todo/project-name") but that didn’t work, either.

All I can think of is that some plugins are conflicting with each other, but I disabled everything else I have (Reminder, Tasks and Natural Language Date) and that didn’t get the queries to work.

What did work was repeating the tag for each task

  • [ ] do this #todo/project-name
  • [ ] and this #todo/project-name
  • [ ] etc this #todo/project-name

And then querying with dataview

TASK FROM #todo/project-name
WHERE contains(tags, “#todo/project-name”)

But this is not what I want…

Please. Help :frowning:

  1. Each plugin has is own rules, syntax, etc. They’re build with different goals. Some work together in some features/syntax (for example: Dataview and Tasks), others not.
  2. The main source for understand plugins is (if it exists) the documentation. There we can see the goals, the global logic, etc.
  3. This to say: we can’t write things in one way and expect that some plugin works with the way we defined. We need to understand the plugin rules, their advantages and limitations, and write our notes accordingly.
  4. You use tags somewhere in your note. Why you think the tags works as a header/section to everything that follow the tag? It doesn’t work in that way. Maybe with the Checklist plugin (I don’t know, never tried), but for Dataview tags in the content are simple tags at page level.
  5. In Dataview only lists (bullet point lists) and tasks have their own sub-level with specific metadata (metadata, the core of dataview plugin) and there we can find the section/header information.
  6. I.e., if you write headers:

## project-name

- [ ] do this
- [ ] and this
- [ ] and this, too

other content

## another-project

- [ ] something

(#tag is used only to identify the file, you can define as source all files in specific folder or other filter options)

Then you can query tasks inside the header/section another-project with the query:

FROM #tag
WHERE meta(section).subpath = "project-name"
  1. Dataview docs

Just to add a thought to @mnvwvnm 's answer:

Dataview sees your documents primarily at two levels: the page level and the task level.

So if you would like to use Dataview to organize these notes, you either need to tag each task with its project (as you saw), or else you need to keep each project in its own page.

It’s possible to keep each project on its own page and still have a single page with all your projects on it. You can do this by embedding each project onto your top-level page.




The docs for Checklist do include a “group by tag name,” which is what I’ve done (and what that tutorial seems to do).

But since I am using Dataview to query, seems like best bet for the behavior I want is to use the headers as you suggest.

What I do is put the tag in a heading like this:

### #todo/project-name

- [ ] do this
- [ ] and this
- [ ] and this, too

and then use the Obsidian Tasks plugin with a query like:

not done
group by heading

Since I’m using the #todo/ prefix which I’ve set inside my Checklist plugin, my tasks are compatible with both plugins.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.