Task query from sub-header

Hey All,

I’m using a classic “# header” “## sub-header” note structure, with embedded tasks.

When querying tasks that are in the “Top” header, I’d like to get the ones which also are in the “Sub” header.

For example:

In document:


  • level1


  • level2

I’d like that:

not done
(heading includes Top)

returns both tasks, “level1” and “level2”.
To me, “level2” is under “## Sub”, which is itself under “# Top”, so it would make sense that both tasks are returned.

Is there something wrong in my (simple) task query?

Thank you!

I don’t think neither Tasks nor Dataview has any concept of multi level headings. Either a task is under the nearest heading, or is not under any headings. Which level that heading is, or if there are other headings outside of it, is ignored by the plugins, if I’m not mistaken.

However, there are metadata within Obsidian, which could be used to code something like this. One idea based on metadata I’ve seen in the cache is to build a table or task list, and do postprocessng looping through the different line numbers of the headers compared with the line number of the task.

If one makes a loop keeping track on multiple heading levels with line number, it shouldn’t be too hard to compare against line numbers of tasks, and/or go up and down the current section level one are at…

But it do require some coding, for sure.

I understand, thanks a lot (again) holroy.

I won’t go down that route, I will find another way to categorise such tasks (tag, …).


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