Query all items excluding items under a section

I keep a daily journal with Obsidian (as lists prefixed with the current time), and in my daily journal files I have a heading or section called “Tasks”, where I query tasks to see the most relevant one for the day.

To quickly review my past journal entries, I use a dataviewjs query to get an (endless) list of all my journal entries (like in LogSeq), for all days, at least for a couple of days.

This is the dataviewjs-query I use:

for (let p of dv
.pages('"journal"')
.sort((page) => page.file.name, "desc")
.where(
(page) => page.file.name >= "2021-07-01" && page.file.name <= "2023-07-31" 
)) {
//dv.header(1, p.file.name);
// dv.paragraph("Journal for [[" + p.file.name + "]]")
dv.paragraph("![[" + p.file.name + "]]");
}

It works fairly well.

Now for the review of my journal entries, I’d like to exclude the section “Tasks” and all the queries beneath that section, as it adds no insight in reviewing my journal entries.

I followed this [1] thread and managed to view my journal entries excluding the section “Tasks”, but this is a flat list, no outline structure of my journal files is preserved (I can live with that). And the filename is repeated for every list item from my journal files. Here’s my dataviewjs-query:

TABLE L.text as "Note"
FROM "journal"
FLATTEN file.lists as L
WHERE meta(L.section).subpath != "Tasks"
SORT file.name desc

Is there a way to make this query result more readable? For istance I tried to group by file.name, but that did not work.

[1] Dataview (or other) query for all items in page "section" - #4 by mnvwvnm

1 Like