fbpx

FREE! Plan Your Ideal Week: Bonus Workshop + Planner  →  Get the Workshop

Obsidian Task Management Queries

Previously: Obsidian Task Management Basics

In the first video on task management in Obsidian, we talked about some of the basics regarding task management and the essential plugins that you’re going to need. In this video, we’re going to expound on that foundation and show you how to create queries that allow you to look through your entire Obsidian vault and return only the tasks that meet certain criteria.

This is exactly what professional task management apps like Things, OmniFocus, or Todoist do really well โ€” they can give you a shortlist of the things that you should be paying attention to right now. I’ve added several different tasks throughout my Daily Notes, as I showed in the previous video. And I’ve also created this Obsidian task management project note, which has some todos broken down here for the different videos in this series. Each of these uses has the #todo tag based on the filter that we set in the previous video for the Tasks plugin, the name of the task, and a due date for most of these tasks. Now there are some that are blank, and that is intentional because we’re going to look at now are some filters that we can use to look through all of these things and return only the things that meet certain criteria. So let’s create a new note called Example Queries.

Okay, now the first thing we need to do in order to create a query in Obsidian using that tasks plugin is to use three backticks and the term tasks.

Whatever we put in between these lines is going to be the criteria that the tasks plugin uses to show us the tasks that are relevant. So for example, we could show all of the tasks that are due on a certain day by typing in the due date right here. So we could say due on a specific date. And now when we switch to the reading view, Obsidian shows us the tasks that we should be thinking about because they are due on this specific date. Now, these are tasks that are due on a date, but we can also use additional modifiers. Like due before or after a certain date, all of the tasks that don’t have a due date, or all of the tasks that meet certain criteria. So let’s say we want to show all of the tasks that aren’t done. That would look something like this:

```tasks
not done
```

Now, this is obviously a very long list. But where these examples get powerful is when you start to mix and match these different criteria. So for example, if you want to create a query, which shows all available tasks that are due today, you might use something like this: not done, due today. Based off of that criteria, in my entire Obsidian vault, there are seven tasks that I should be looking at here.

We can also filter this by location. So maybe we want just the tasks that are due on Friday, and only the ones that are in our Daily Notes folder. That would look something like this:

```tasks
due on 2022-05-06
path includes Daily Notes
```

And here’s what it looks like when rendered:

If we want to eliminate the done tasks, we can just add an additional line here for not done. We can also make this a lot cleaner. For example, mow the lawn has an icon here for a repeating task with the description of the repeating task every week on Friday, as well as the due date for this task and the page that it comes from. But if all we wanted was the list of tasks, we can actually use what’s called short mode to clean this up.

```tasks
due on 2022-05-06
path includes Daily Notes
not done
short mode
```

We can still get to any of that information by hovering over the icons. But now it looks a lot cleaner.

Alright, let’s go back here again, and look at another test query, one that can help us find tasks that may have slipped through the cracks. Let’s say we want to query which shows everything that does not have a due date. All we have to do is put no due date in the query.

```tasks
no due date
```

And now when we go back to the Reading view, it renders like this:

We see the four tasks from our Obsidian task management note, which don’t have a due date added. But to add a due date to these, all we need to do is click the pencil icon to edit the task, add the due date, and click Apply.

And that task is removed from the query because it now has a due date attached and no longer fulfills the search criteria. So using the available filters with the Obsidian task plugin, you can recreate just about any task management workflow that would be available to you in a dedicated task management app with the added benefit of having all of those tasks reside inside of your Obsidian vault, and not necessarily needing to have those tasks associated with a specific note. The Tasks plugin doesn’t care where these tasks exist, it’s looking at everything. So you can build these queries into whatever notes you happen to look at a lot inside of your daily notes. For example, one of the things that we could do is we could take a query of the tasks that are due today and embed that inside of our Daily Notes template.

So let’s go over here to our templates folder. Scroll down to Journaling Template, which is the file that we’re using for our daily notes. Let’s add a new section called Due Today and embed a query here. First, we want to show all of the tasks that are not done. And we want them to be due on the day of The Daily Note that we create this. So we’ll add this code right here:

```tasks
not done
due on {{date:YYYY-MM-DD}}
```

Okay, so there’s our date token. Now when we click on a date in the calendar, it will replace that token with the date formatted that way for the specific Daily Note. So let’s go to May 6, click on it on the calendar in the right sidebar, and click the Create button to create the note. You can see the filter automatically updated that token. So now when we go to the Reading view, we get a list of all the tasks that are due today.

Now obviously, this is just the beginning of the types of queries that you can create inside of Obsidian using this Tasks plugin. But this is the one that I use every single day, and this is the place that I would recommend you start. You can always create other queries later, as you figure out what are the specific use cases for your own Obsidian workflow where you would want to see tasks that meet specific criteria. But if you dig into the documentation, you’ll see that you have all of the tools available for you to create any sort of query that you can imagine.

Next up: Obsidian Task Management Review