Filtering tasks by heading in dataview

I’m trying to generate a list of tasks in Dataview (I prefer it to tasks) with multiple conditions, one of them excluding a specific heading… but I don’t know how to refer to the heading in dataview.

I tried

!contains(heading, "XYZ") 

In tasks, it would be

heading does not include XYZ

What is the equivalent in Dataview?

What I’m trying to do

1 Like

There’s no “heading” implicit field in dataview metadata.

You need to play with the implicit field section (there is also the field header, but it will be depreciated):

https://blacksmithgu.github.io/obsidian-dataview/annotation/metadata-tasks/#implicit-fields

But the value in this field is a link to the section. So, to target a specific heading (a string) you can’t filter directly the field (a link). To do that you need to use the function meta():

https://blacksmithgu.github.io/obsidian-dataview/reference/functions/#metalinksubpath

Something like:

WHERE contains(meta(section).subpath, "xyz")

The main point is: if we want to play with a plugin, we need to start with the plugin documentation. It requires time and a long learning curve. And doubts will appear (but based on something).

3 Likes

Thanks! This works as intended… I have a really hard time navigating the documentation, I did find the “section” field but completely missed the meta function.

1 Like

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