What I’m trying to do
I have built a simple master tasklist with dataview that pulls (not completed) tasks across all of my different files into one new file. In general, I have many of my tasks tagged, and among those, some have a due date. Let’s say I have two tags, #CategoryA and #CategoryB, and then a bunch of untagged tasks.
I am trying to structure my master list such that:
- It is grouped by tags/ categories, so that all #CategoryA tasks are grouped, then all #CategoryB tasks, and then all untagged tasks come as an “Other” group. This part I have gotten to work.
- I want all tasks in the CategoryA and CategoryB lists to be sorted by due date, so that the more urgent ones are on top. Can’t get this to work.
- Bc the list of “Other” is quite long (all my untagged tasks across all my other relevant files), I would like to then add a sub-structure grouping within the Other category, simply by file.name
Things I have tried
For 2), this feels like it should be quite simple; I’ve tried various basic sort due (as well as following the advice around SORT min(rows.due) here). I don’t get error messages here, but the tasks just don’t resort themselves (including after refreshing dataview, restarting obsidian, etc).
For 3), I’ve tried various combinations of choice operators (and extensively tried getting ChatGPT to help me get this right for several hours), but nothing seems to work.
Code
The basic code that satisfies 1) above but from where I haven’t been able to figure out adding 2) or 3) without errors / it not doing anything, as described above:
task
where !completed
group by choice(
contains(text, "#CategoryA"),
"Category A",
choice(
contains(text, "#Category B"),
"Category B",
"Other"
)
) as "Category"