Showing todos with specific date in them with dataview?

Is there a way to use dataview to show unchecked todo’s with certain date in them? What I’m thinking of doing is to create a daily note that would contain a dataview-block. That block would show all todo’s that have current date in them. What I mean is that I would be creating inline todos in various notes in a format something like this:

[ ] Pay 20$ back to Jack-2020-12-23

Then, when I’m on my 2020-12-23-daily note there would be a dataview-block that queries all my notes, and extracts the todos that have the current date in them. So every time I’m at new Daily Note, it would show my todo’s that are due that day.

Have you seen the Kanban plugin? I think there might be a way to combine it with dataview…

We can look to your question in two ways:
1 - you already have a formatted tasks with a date inside task text (“2020-12-23”) and want to know how (and if possible) to query this “metadata” via dataview
2 - or you want to know the best way to add due dates to your tasks to easily be queried by dataview?

Which is the intended case?

1 Like

I guess both :). Basically I want a way to add due dates to tasks, and I want a way to show those tasks on that day in a separate note. Of course I could have a specific"todo"-note that I can check, but I would like to be able to create todos inline, no matter where I happen to be, and then have those todos be visible in another document on that day.

After I wrote my original post, I came across this YouTube-video which seems to describe what I want: My new favorite productivity tool - YouTube (starting around 12:10), and it doesn’t need data view to function.

Yes, you can try Tasks plugin. But if you want to use dataview for other purposes, than you can have only one plugin, because dataview can do same thinks - maybe not so “automatic” to create tasks but once created can do similar queries.

How would I do this with dataview? I currently have a template for tasks, and it contains “DoDate:: [[YYYY-MM-DD]]”, which is a link to the current days daily note. And in that Daily Note I would have a dataview table showing all todos with DoDate of that day. So, how do I tell dataview to show all #tasks (which I use to differentiate tasks) with DoDate same as the current date?

First idea would be to use the “date(today)” somehow, but that wouldn’t work, because if I looked at daily notes from other days, it would show tasks with DoDate of today, instead of DoDate of that date.

I mean, it’s a link to the DoDate’s daily note…

Well, you can adopt many approaches but first you need to clarify more things.

  1. Where you place DoDate:: [[YYYY-MM-DD]]? In each task or outside tasks? If in each task, as inline field, you need to use brackets. (to clarify it’s better if you give examples: how you place tasks and how you create your daily note)
  2. Why you use DoDate:: [[YYYY-MM-DD]] with link to your daily note? It’s really necessary? I ask this because in some cases a link to nonexistent note (yet) can be problematic.
  3. Examples:
## tasks on a note

- [ ] This is a task with inline field to due date [due:: 2021-12-19]
- [ ] Other task with inline field using different brackets [due:: 2021-12-22]

## query to place in daily note with title in yyyy-mm-dd format (e.g. "2021-12-19") 

### today tasks

WHERE due =

## query to place in any note defining the wanted date

### tasks with due date "2021-12-22"

WHERE due = date(2021-12-22)

### uncompleted tasks with any due date

WHERE !completed AND due - date(today) >= dur(0 days)

### uncompleted tasks for this month

WHERE !completed AND due.month = date(today).month AND due.year = date(today).year


Thank you for your help, I really appreciate it :slight_smile:

  1. Where you place DoDate:: [[YYYY-MM-DD]]? In each task or outside tasks? If in each task, as inline field, you need to use brackets. (to clarify it’s better if you give examples: how you place tasks and how you create your daily note)

I basically have a separate note for each task. The note looks like this (still a work in progress):

Date Created:: [[<%“YYYY-MM-DD”) %>]]
Relevant Notes::

Plan is to list these notes as a TABLE with dataview.

Daily note is created with the Periodic Notes plugin.

  1. Why you use DoDate:: [[YYYY-MM-DD]] with link to your daily note? It’s really necessary? I ask this because in some cases a link to nonexistent note (yet) can be problematic.

I like to have the connection between tasks and dates, so I could go back and see what I have been up to and it might give me more insight in the graph view.

I got this to almost work… If I have the DoDate as a plain YYYY-MM-DD date, it works. But if it’s [[YYYY-MM-DD]] then it doesn’t work. So I need to somehow figure out how to tell dataview “if the DoDate is a link to this file, list it here” or something.

Another question mark is how to implement a “Due tomorrow” and “overdue”-tables. Logical answer would be to use DoDate = date(tomorrow) etc, but that has the issue that If I’m looking at past daily notes it would use the current date for the query, instead of the date of the daily note. But that’s a minor thing. And it kinda seems like it doesn’t understand YYYY-MM-DD links as dates as well.

I’ll look with more attention to your answer later. But for now two observations:

  1. Are you sure this is the best approach to use tasks? A note for each tasks? (I can understand better if each task is like a true note - a kind of project -, not a simple to-do task with this format: “- [ ] This is a task for what I need to do tomorrow”). If a simple task (with the square/circle to mark checked/unchecked) you can’t check your tasks in a table!
    In a table you can see the text inside each task, not the checkbox. (On the contrary, you can do that in “task” queries).
    For me isn’t clear the type of tasks you are talk about.
  2. Without clarification of the type of tasks, I can’t understand if you just need to call metadata from page level or from task level (a kind of second level of metadata inside page first level)

OK, I’m thinking that I will have a separate “DoDate” with a plain YYYY-MM-DD date, and a separate “Daily-Note”, with a link to the daily note. This way I have the link between the two notes, as well as a date I can do stuff with. Unless there is a way to use the link as a date as well…

Are you sure this is the best approach to use tasks? A note for each tasks?

That’s a valid question. I feel that having a separate note for each task give me a lot more flexibility going forward. I might also look in to using simpler tasks as well, but I feel this approach suits me the best. It might be that the simpler tasks are more suitable for reminders. But this is all still a work in progress.

Well, I can’t replace your process… :slight_smile: you need to discover your path and adapt your method.

So, going directly to the wanted table. What fields you want in the table? As I said before, you can’t get the task rendered as in preview mode (with the check box). To work with a table you need to call fields at page level. For example:

  • To call the text of the task you need to use file.tasks.text;
  • To define your source, you use any tag in your task note? Or it’s necessary reduce the source to all files where you have tasks (WHERE file.tasks)? All your notes with tasks have DoDate (WHERE DoDate)? …
  • To capture date from the link in DoDate use expression like WHERE date(DoDate) = date(today) (example when you want to use a dynamic date(today)
  • If you use Daily note with the title format yyyy-mm-dd you can define the table with the tasks for daily note date with this expression: WHERE date(DoDate) =

(suggestion: try a note with tasks as in my above example and try the simple tasks queries… check directly the task in the dataview task list is very useful…)

I have experimented with those “smaller” tasks. Their main appeal is that I can write them anywhere. In a middle of a note, another today note and so forth, and they could all be collected and shown in central location. In daily note, or in the sidebar. My system too has a central location (daily note), but the process would be a bit more “heavy”. I do have a template that can be called for creating new notes and that takes away some of the friction.

I have a tag #tasks inline in my task-notes (still thinking about using YAML), and I’m primarily calling that when I do the dataview-query. I then have a bunch of fields in the daily note (Project, Deadline. I don’t list the DoDate there, as the table is showing tasks that are Due that day, so it’s redundant). I don’t worry that much about having a checkbox there, as I would have a link I could use to go to the tasks note.

Yes, my task-files all look the same, see earlier the contents of the note.

Thanks to your help, I have pretty much gotten this to work. There is still the issue of working with dates that are not today. For example, for todays tasks, I have this dataview query:

TABLE Project, Deadline
FROM #tasks
WHERE date(DoDate) = AND completed !=1

And for tomorrows tasks I have this:

table Name, Project
from #tasks 
where date(DoDate) = date(tomorrow) AND completed !=1

Both of those work perfectly when looking at todays (18th) note. But if I look at tomorrows (19th) note today for example, it will show me tasks means for 19th in the first table, and for tomorrows tasks it lists the tasks meant for 19th again, because I’m looking at the note on 18th, and right now 19th is “tomorrow”. “Tomorrow” should be in relation to the actual note, and not to the date when I happen to be looking at it. But I have a feeling that fixing that would be very complicated so I might just live with it :).

For “tomorrow” tasks try this:

WHERE date(DoDate) = + dur(1 day)

I think that is working, thanks :slight_smile: ! I will do testing with those smaller inline tasks as well, in case they work better for me.

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