Dataview task to include note title, H1 or annotation field

Things I have tried

  • [ ] Send e-mail to Paul #t/next
  • [ ] Read document #t/pending
  • [ ] Create slides for meeting #t/pending
  • [ ] Get funny video for meeting #t/nice-to-have
TASK WHERE contains(tags, "#t/next")

What I’m trying to do

I have some projects (Let´s say: Project Alfa, Project Beta, Project Delta) and a separate note for each one. Within each note I have some checkboxes with tasks and also a tag (next, pending, nice-to-have) to priorize them.

I want to use dataview to show me in an “All Projects” note all the checkboxes with the “next” tag. I already got that working. But I also want to include the Project Name before or next to each task. The project name is included as the note filename, the H1 and as an Annotation (Project:: Alfa)

I don’t know if it would help to, instead of tags, put the checkboxes after some H2s within the note. If possible, I wold like to avoid adding a tag with the project-name.

Thanks in advance!

1 Like

I understand that you’re trying to manage your tasks based on two things:

  • the status (#t/next, #t/pending, etc.)
  • the project (either as a filename, H1, or inline annotation)

The key is that you can filter (in the WHERE clause) tasks based on the task-level variable text. I don’t know that this is documented anywhere, but I found the approach in this Github discussion comment.

You can also use the section that a task appears in with meta(section).subpath (docs, though I found this from this discussion) or the file name with just file.link (docs, scroll to the “group by” example).

I created two notes in my vault –

# Testing note
## Work for Paul
-   [ ] Send e-mail to Paul #t/next
-   [ ] Read document #t/pending
-   [ ] Create slides for meeting #t/pending
-   [ ] Get funny video for meeting #t/nice-to-have

## Side project
-   [ ] Write draft #t/next
-   [ ] Get feedback from Lizzie #t/pending
-   [ ] Submit proposal #t/pending
-   [ ] Clean up figures #t/nice-to-have

and

# Other note
## Extra
-   [ ] Make dinner #t/next
-   [ ] Wash dishes #t/pending
-   [ ] Start laundry #t/pending
-   [ ] Clean up cat toys #t/nice-to-have

The following query gives me the tasks grouped by section—

task
  where contains(text, "pending")
  group by meta(section).subpath

This groups by file—

task where contains(text, "#t/pending")
group by file.link

2 Likes

Thank you!

What I was missing was the Group By section in the dataview.
Just by adding it as “GROUP BY file.link” gave me the result I was expecting.
Now I get the Note Title and then the tasks.
This solved it!

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