Obsidian Tasks Series, Part 5 - Working with Tasks in Queries
Welcome back to this mini series on the Obsidian Tasks Community Plugin. My intention with this series is to help you learn the functionality of the Obsidian Tasks Community Plugin so you can build a task management system in Obsidian that works for you. There is a YouTube video to accompany each article in this series so feel free to check that out. The videos and and articles roughly parallel one another.
As we begin, here is a rough plan for the series so you can see where we are and what’s coming next. As we continue in the series, I’ll come back and update links to future articles so you can easily navigate between the parts of the series.
Using Task Queries in Obsidian <- You Are Here
Exploring Recurrence with the Obsidian Tasks Plugin
Exploring Project Management with Obsidian Tasks
Building Your Own System Using Obsidian Tasks
Backstopping Your Task Management System
Works Well with Obsidian Tasks Community Plugin
In the most recent article, we focused on creating queries. In this installment, we'll focus on how to edit and customize queries as well as on how to use tasks within queries.
Editing Queries and Adding them from Templates
In the last article, we focused on creating queries. Today, let's focus on how to edit and make the most of those queries.
There are at least two ways you can begin editing a query in Obsidian.
The most common and the one I use most often is to hit the code icon which appears when you hover over the query.
This will take you back to the code for this query and allow you to edit the query.
The second way is to switch into Source Mode. You can do that in at least two ways. The first is to use the command palette (Cmd-P on Mac/Ctrl-P on Windows) option to toggle between source and live preview.
Another option is to hit the three dots at the top right of the note and change to Source View.
While Source Mode is one I don't use as frequently it is the option that allows you to use templates to create queries. At the end of this article, I'm going to show you how to use my favorite text expansion tool - Typinator - to add text right to queries in the task code box. However, if you try to do that with a template, it won't work.
So, if you want to use templates to add commonly used query functions right into the query text, you need to do that from source view. This section is a bit hard to explain in text so if you want to learn more about this, definitely check out the video that accompanies this article. Putting it as simply as I can, if you're in live preview mode and you have a template set up that has JUST language to add to a query (like the command not done), then you MUST be in source mode to add that text right into your query. Trying to add it while in live preview mode doesn't work.
Making Queries Prettier
There are a wide array of ways you can customize your queries to make them look just how you want. I'm going to demonstrate a few of the use cases for you today. As a reminder, the Obsidian Task Query Quick Reference has all of these listed for you. Pay special attention to the column labeled Display as well as the group of display options at the end of the quick reference chart.
Towards the end of that list there are some options that are really all about how your query looks. Let's start by talking about short mode versus full mode.
So far, all the queries you've seen have been in full mode as that is the default way that a query displays. If you want a fast and easy way to make a query's look cleaner, then try short mode as a part of the query. Here are two different queries - the first is in full mode and the second is in short mode. I've situated these so you can see the query on the left and the output on the right.
In some instances, this quick short hand might be a great way to streamline what you see in a specific query.
In short mode, when you hover over the emojis a little note pops up showing the detail for that task. If you hover a bit longer over due, scheduled, or start, another little tool tip will show up that says "Click to edit..., right click for more options." We're going to dig into all of those options in a moment.
You might be asking yourself, when do I need to use the full mode command. While I’m not going to go too in depth on it in this series, there are a set of Tasks properties that get added to your vault when you install the Obsidian Tasks Community Plugin. You can actually add these properties to a file (or a template to apply them to lots of files) to set how task queries in that file behave. One of those is the option for short mode (TQ_short_mode). It is a check box property. If it is checked then every task query in that file will be run in short mode WITHOUT you having to type the command short mode. If you wanted a single query to display in full mode in a file with that property turned on, then you would use full mode.
Working with Tasks in Queries
Depending on how you set up your task management system in Obsidian, you may be interacting with your tasks more often in queries than you do in their original context, so it's important to know how to edit tasks in queries.
Using and Hiding the Edit Button
The first option is to use the edit button that is at the end of every task. It is the button that looks like a pencil on a piece of paper.
Clicking the edit button opens the create/edit task modal for this task. Just remember, that based on the settings of this query, the task may disappear from that query based on your editing. For example, if I am editing the due date in a query for tasks due today then that task will no longer show in that query after I change the date to anything other than today.
If you don't want to see the edit button, use the hide edit button command in a query. Most of the time, I like having the edit button on my tasks. However, in some of the ways that I'm using custom statuses now, removing the edit button actually makes sense. Let's look at an example.
I've modified a query we saw earlier in the series to show a small subset of my favorite quotes from around the vault. This is one where I might not want any of the options for editing to display, let's take a look at all the things we can hide by looking at the code for this query.
As you can see from the query text on the left, I can hide the edit button, the backlink to the page where the task lives, and then the count of tasks at the bottom. I also added short mode to this, although in reality in this query, it's redundant. In this specific use case, this makes a really nice display of quotes.
Remember that you can also hide things like tags. In the particular use case in my main vault, I'm adding a fave tag to quotes and notes that I want to display in certain locations. Hiding the tags after searching a file for just my favorite quotes leads to a much cleaner look.
Editing Dates
As you're working with your tasks, there are a number of reasons why you might need to edit dates on a task. You can edit each specific date simply by hovering over the date when you're in full mode.
As I mentioned earlier, when you hover, a box explaining your choices should appear over the date. You'll see it in the image below.
The first option is to left click the emoji or the date itself. This will pull up a date picker that you can use to select any date you want. The other option is to right click. This gives you a limited set of options to choose from, although may be faster if you're just postponing tasks a day or two.
You can postpone a task by 1 day by using this double forward arrow button. Right-clicking the postpone button gives you additional options.
I don't actually use Postpone all that much so you can add hide postpone button to queries in order to not even have it added if you don't want it there. There are also options within the Obsidian Tasks Community Plugin settings that will allow you to add something like this to what is called the Global Query if you NEVER want the postpone button the screen. Please note that this can be undone in an inline query simply by adding "ignore global query" to your query. You could also come in and delete the global query or part of it if it is interfering in your vault.
I walked through the global query in some detail in the video so be sure to check that out if adding settings across your vault is of interest to you.
If I see a big list of incomplete tasks, it can make my brain go a little numb, so I like to use the limit options regularly in my vault. Let's look at those to close out this video.
First, we can limit the number of tasks in a specific query. There are two ways to do this that produce the exact same result - limit followed by a number and limit to X tasks where x is the number of tasks you want displayed. Let's see how this works on a list of all overdue tasks in this vault.
In the example here, I used the shorter limit 3 as opposed to the longer limit to 3 tasks. There is no right option. I usually choose the plain limit 3 simply because it's shorter.
In addition to limiting tasks in a query, you can also limit tasks by groups if you're using grouping. Let's look at a query similar to one we used earlier in the series - one to look at all tasks grouped by page in the Projects folder.
With something like this, you start to get to a very simple task management system. We're getting there, but before we create your system, there are two more parts of the anatomy of a task that we need to walk through - recurrence and project management. Those are up in our next two videos and articles.
👩🏻🤝👩🏽 Join a community of people seeking to get better at being authentically themselves — and get access to everything I write and publish early as well as bonus content and more on Circle. You can have Free Guest Access
or access to a year of Obsidian Office Hours (Small Paid Fee)
📰 Want to make sure you never miss a story from me? Subscribe to my newsletter. I send out a fresh new article and do a round up of everything I published that week. It is released for free every Monday.
Book a free, no obligation 30 minute coaching call to see if we’re a good match for productivity, career, or financial coaching.
Visit my website: https://www.monarchstrategiesllc.com