Relatively simple(?) Dataview question - list pages containing incomplete tasks

Things I have tried

Sorry but I am not knowledgeable on js, but have searched forums and websites for advice, but I am unable to find a solution myself. I’ve tried modifying the query (below), but I really have no idea what I’m doing.

What I’m trying to do

I am trying to simply list all notes in my vault that contain uncompleted tasks. I have already got the js code for a list of uncompleted tasks, which works great, as follows:

	dv.taskList(dv.pages().file.where(f => f.name != "my excluded files...").tasks
    .where(t => !t.completed))

But I want to get a (clickable) list of just the file names, not the individual tasks. Ideally I would really like it to say how many uncompleted tasks there are for each file.

Any help would be greatly appreciated!

Thanks

1 Like

Two questions:
1 - It’s JS a required prerequisite? Why not DQL?
2 - If you don’t want the tasks but the links to the files with the tasks, why a task query?

For test purposes, you can start with something like this:

TABLE filter(rows.T, (t) => !t.completed).text AS "Uncompleted tasks", length(filter(rows.T, (t) => !t.completed)) + " / " + length(rows.T) AS "Uncompleted / Total"
FROM "your-folder-path"
WHERE !all(file.tasks.completed)
FLATTEN file.tasks AS T
GROUP BY file.link
SORT rows.file.name ASC

(change “your-folder-path”)

2 Likes

Thank you very much for your reply.

  1. JS isn’t required, it’s just what I was using to try to achieve the result.
  2. I just posted the ‘tasks’ example as it was close to what I wanted, but you’re right that a tasks query would never produce the result I wanted. I was trying to amend it to a list query.

This will do it - I can work with this. Thank you very much for your quick reply and your help.

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