How to exclude certain notes/tasks from Dataview

What I’m trying to do

I am using one note with the following dv code:

dv.taskList(dv.pages().file.tasks.where(t => !t.completed));

This code allows me to check all the uncompleted tasks ('- ') that are in my vault. It is very helpful to quickly find tasks that I mentioned somewhere, but haven’t done yet.

I also have some notes with checklists. I use them frequently for different activities and they are also helpful for me. But they also appear in the list of all uncompleted tasks, which makes my dv create list a bit too long.

Now, I want to modify this dv code to exclude certain notes that I use as a checklist. Could you please help me with it?

Things I have tried

I tried to search something about dataview help page and in Obsidian’s help page, but couldn’t find anything.
Since I don’t really know how to modify dv code, I didn’t try to do it either.

There are many ways to do this, and I would typically use a tag to denote those files having the checklists. This would give you a nice dynamic way of adding new checklists without having to update the tasks query with new exclusions.

So add a tag like checklist to the notes you don’t want to include, and change the dv.pages() to dv.pages("-#checklist") and you should be done.

In my personal vault I’m using a similar setup where I tag the other way around. That is I’m ignoring all tasks that’s not tagged with #globalTask unless they’re located in my daily notes. This allows me to limit where in my vault I’m looking for tasks, but still gives me the possibilities to add random tasks from everywhere. Eventually this allows me the freedom to use tasks outside of my daily notes for checklists, todo lists of stuff I might get done at some point, projects detailed with many tasks, and so on. None of these will clutter my main task list, unless I choose to tag that particular task to be included. And I could use other criteria to build different task lists, like an overall project task list or similar.

That is a brilliant solution.
I just added ‘’‘#Checklists’‘’ to those notes that I wanted to be excluded and added the code like you suggested. I tried it and it worked!

Thank you very much, @holroy.

1 Like

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