Dataview plugin snippet showcase

Using Dataview 0.4.21 or later you can query for tasks under a specific heading. For example if you have multiple project files which have “Next Actions” sections like this:

## Next Actions

- [ ] schedule a meeting
- [ ] write notes

You can show all of the tasks from all of those Next Action sections with this query:

```dataview
task
where meta(section).subpath = "Next Actions"
```

By default the tasks will be grouped by file. If you want them in one combined list you can add a group by clause like this:

```dataview
task
where meta(section).subpath = "Next Actions"
group by "" as ""
```

This works because each task has a section property which is a link to the specific section of the file where the task is written. The subpath property of the section link gives the heading text for that section. Normally when you access a property on a link you get the property value of the file that the link points to, not the property of the link itself. So section.subpath does not work. The new meta function provides a way to access metadata of the link itself; so meta(section).subpath gets the subpath property of the section link.

9 Likes