[Dataview] Sorting Tasks grouped by File > Heading

I’ve got the following query

where !completed
group by link as origin
sort origin.file.mtime desc

By grouping my tasks with the metadata field “link” or “section” I can group my collected tasks into File > Headings. I figured out how to sort the Files by date modified but unfortunately inside a Task group for a file all the headings are sorted alphabetically instead of “in order of appearance”. Does anybody know how I could achieve this?

Cheers everyone :slight_smile:

What do you mean with “in order of appearance”? And the query you show doesn’t sort on headings, but on the modified time, so what’s that about?

And finally, when doing a TASK query, you’ve got plenty of stuff to play around with in the WHERE and SORT clauses, see Metadata on Tasks and Lists - Dataview

In your case, you might be interested in text having the text of the task,
so maybe just do something like:

WHERE !completed
GROUP BY link as origin
SORT origin.file.mtime DESC, text ASC

hey :).

okay let me show you what i mean.
With the query i’ve posted i’ve got the following results from dataview.

here i’ve got a file “test note” with three headings in the order B > C > A.
To group tasks into File + Heading i can use the task metadata fields like “section” or “link”. But with these fields, headings inside files will be sorted alphabetically.
I’ve already tried to sort addtionally by several different metadata fields for tasks but could not find a solution.

my goal is to sort tasks by files (as date modified) and then inside those files sorted in the order they appear inside the file. right now dataview sorts the headings inside the file alphabetically, as you can see in the screenshot.

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