Support sorting tasks based on file name and task description
See original GitHub issueIt would be great if one can sort tasks based on file name and tasks, e.g., task descriptions.
This request can also be seen from the following comment and the related issue.
https://github.com/blacksmithgu/obsidian-dataview/issues/46#issuecomment-896863259
First, I may query all tasks from files within a folder with something like:
dv.taskList(dv.pages('"Daily note"')
.file.tasks
.where(t => !t.completed)
)
This lists all uncompleted tasks from files within the folder Daily note. However, I am not sure how are the task files sorted. Therefore, I would like the tasks to be sorted based on the file name where they come from, e.g. Note A, Note B, Note C, etc. Each of such a note/file consists of a series of uncompleted tasks.
I tried the following options (without knowing if the syntax is correct or not 😦, however), but neither of them worked for me.
dv.taskList(dv.pages('"120-Daily note"')
.file.tasks
.where(t => !t.completed)
.sort(p => p.file.name, 'asc')
)
dv.taskList(dv.pages('"120-Daily note"')
.file.tasks
.where(t => !t.completed)
.sort(t => t.file.name, 'asc')
)
Of course, it would be great if the tasks from individual files/notes can also be somehow sorted, e.g., based on task description.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
I’m going to add a more general
dv.taskGroup
(or something similar) which takes in a list-of-lists, which you can use the standard data array operations on to get exactly your desiring ordering.Just wanted to voice that, like @TangentFoxy, I would like to use dataviewjs to sort my taskList by the file that they occur in but cannot find any documentation for dv.taskGroup that was supposedly added.
Specifically, I would like to replicate the functionality of this DQL using dataviewjs:
The following does not impact the order when ‘desc’ is changed to ‘asc’ or vice versa:
The following return an evaluation error:
Apologies if I am overlooking something obvious.