Sort tasks using file metadata #2895
-
I'm implementing a GTD inspired todo setup. I have a note for each large-scale project, and within those I put tasks related to that project. I'm using YAML metadata to add an "importance" attribute to each project, indicating how much time I want to focus on getting it done. Is there a way to write a query that sorts tasks by urgency, and then by the "importance" metadata attribute of the file each task defined in (defaulting to 0)? Let me know if this doesn't make sense - English is so much less precise than code. Update: see #2895 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Yes, if you are willing and able to write a little JavaScript.
I don't have time to write custom instructions for users - so here are some pointers to get you started:
|
Beta Was this translation helpful? Give feedback.
-
If you do get something working, please kindly record the solution here. Many thanks. |
Beta Was this translation helpful? Give feedback.
-
I have ```tasks
not done
(scheduled on or before today) OR (due on or before in 14 days) OR ((no scheduled date) AND (no due date))
sort by function reverse \
const taskFileCache = app.metadataCache.getCache(task.file.path); \
const frontMatter = taskFileCache.frontmatter || {}; \
return task.urgency + (frontMatter.importance || 0);
``` This isn't exactly what I said earlier (it combines importance and urgency, rather than sorting by one than the other), but I like it better. |
Beta Was this translation helpful? Give feedback.
Yes, if you are willing and able to write a little JavaScript.
I don't have time to write custom instructions for users - so here are some pointers to get you started:
by function
examples in the Filters, Sorting and Grouping pages in the docs.