Can't sort dataview tasks by file name after grouping

Things I have tried

Howdy guys!

I have a standard daily notes, each note has a date in file name (like 2022-10-18.md) Sometimes I add tasks to my daily and not everyday I finish it. For this puprose I’ve made a dataview task list, here is my code snippet

TASK
FROM "daily"
WHERE !completed AND meta(section).subpath = "logs" AND date(today) != date(file.name)
SORT file.name DESC
GROUP BY file.name

so, SORT file.name DESC - doesn’t work at all. If I group my daily by day, it can’t be sorted =( Without grouping all works as expected. So my question is - how to sort grouped task?

Some points:

  1. you know the implicit field file.day for notes with recognized date in the title? (docs)
    If your notes have the title format “YYYY-MM-DD”, then you have an implicit date associated with the file. This allows you to replace date(today) != date(file.name) by file.day != date(today).

  2. Related with the previous point, ignore the SORT file.name DESC and add SORT rows.file.day DESC in a new line after the group command (not before). [you can also use SORT rows.file.name DESC]
    The point is: after the group command you need to add the prefix rows to access to the fields keys.

TASK
FROM "daily"
WHERE file.day != date(today) AND meta(section).subpath = "logs" AND !completed
GROUP BY file.name
SORT rows.file.day DESC
1 Like

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