Hello, I am trying to create a dataview task list with header and sub-header hierarchy. In the dataview, I would like the date (e.g., November 21, 2023) as the heading and the meeting title (e.g., Meeting A) as the sub-heading.
Here is the task list format:
November 21, 2023
Meeting A
Task 1A
Meeting B
Task 1B
Task 2B
Task 3B
Meeting C
Task 1C
Task 2C
Task 3C
November 22, 2023
Meeting A
Task 1A
Meeting B
Task 1B
Task 2B
Task 3B
Meeting C
Task 1C
Task 2C
Task 3C
November 23, 2023
Meeting A
Task 1A
Meeting B
Task 1B
Task 2B
Task 3B
Meeting C
Task 1C
Task 2C
Task 3C
Things I have tried
I have tried GROUP BY by header and GROUP BY meta(section).subpath but it does not provide the heading and subheading hierarchy.
I think what you are trying to do is not possible. If you look at the doco, the first part of the task description says,
The TASK Query outputs an interactive list of all tasks in your vault that match the given data commands (if any). TASK queries are special compared to the other Query Types because they do give back Tasks as results and not pages . This implies that all data commands operate on Task level and makes it possible to granularly filter your tasks i.e. for their status or meta data specified on the task itself.
I think that bit about it being different to the other dataview types because it gives back tasks instead of pages, means that you are doomed.
I have been avoiding DataviewJS, but find myself in a situation like you quite regularly now, where I just want to wrap something in a for/while loop… So perhaps that is the answer… then you can loop by day in js, and then just use the DV object for tasks per day.
Using basic queries, you only get one level of grouping. Using a pure dataviewjs you can get two level of queries (at least for more generic queries), using a “group in” function. You can also combine the two in two variants.
You could either use a standard query and group on the combination of the day and meeting. It’ll be one level of headings, but you’ll get the tasks in their proper groups.
Or you could use a standard query called from dataviewjs, and manipulate the output. (This is if you don’t want to or can’t use the dual grouping it’s offering)
I figured out how to list all the tasks in the file “Tasks” with the dataviewjs code (below). However, I am struggling how to incorporate the group by function with headings documented here: Grouping - Tasks User Guide - Obsidian Publish
Any ideas?
group by function (task.heading + ‘.md’ === task.file.filename) ? ‘’ : task.heading
You’re mixing stuff from two plugins here. The “group by heading” is related to the Tasks plugin, but the other advice has so far focused on the dataview plugin. They’re two different beasts…