Tasks + Dataview: show only tasks AFTER today

Things I have tried

    ```dataview
		TASK 
		WHERE regexmatch("^\d{2}:\d{2}", text) AND !completed
		WHERE due <= date("tomorrow") + dur(7 days)
		SORT file.mtime ASC
    ```

What I’m trying to do

I am trying to list the upcoming tasks for the upcoming 7 days BUT NOT for/including TODAY. So all tasks as of tomorrow, for the next 7 days.

I am using these plugins:

  • Periodic Notes (Daily Notes are titled [[YYYY-MM-DD]])
  • Tasks
  • Dataview

Can someone help me with this?

I’d think this would be relatively simple but I’ve been at it for hours and it keeps giving me today’s tasks too, no matter how i write the code. I haven’t kept a record of all the things I tried, sorry…

Does this excerpt work to show things due tomorrow but not today?

WHERE due > date("today") AND due <= date("tomorrow")

Hopefully it does and then you can add the relevant bit into your more complicated query. Note that if you took out the equal sign in my excerpt here you should always get no results since no days are both after today and before tomorrow!

1 Like

If you are already using the Tasks plugin, whey not just use that inline query instead of dataview?

```tasks
due after tomorrow
sort by due
```

I know this goes beyond the next seven days. It also will not capture tasks without a due date (I use a separate inline query for those).

2 Likes

Thanks for your reply, @egauthier ! I am currently trying out which best serves my tasking-needs. Dataview and dataviewjs I think can query more complex things, and at first I thought the tasks plugin couldn’t do what I want. Now it seems that it can, for what I need now. I’m still setting up templates for periodic notes etc. so nothing can yet be harmed in anyway. Just making up test tasks that I throw away if I mess up. It’s quite a bit of work for a non coder like myself, I literally need help with just about everything. But I like to learn by copying and doing and trying, so :smiley:

Yesterday or so I came up with this after an extensive Google hunt :sweat_smile:

due after {{date:YYYY-MM-DD}}
due before {{date+1W:YYYY-MM-DD}}
description includes :
sort by due
sort by description
hide backlink
hide done date
hide task count

and that works.

  • The “description includes :” means the query searches for any task that has a HH:mm time in the description.
  • using “due after {{date:YYYY-MM-DD}}” and “due before {{date+1W:YYYY-MM-DD}}” has the advantage that I can create Daily Notes in advance and it will only show in that future Daily Note, tasks that are actually due on that day (in the future) whereas if you would write “due today”, it will give you the tasks for the actual today, which means I can’t plan ahead. Well I can, but I wouldn’t see the tasks for that day in the future. @scholarInTraining and I haven’t figured out (yet) how to achieve the same with dataview.

For uncompleted tasks with no time (with or without due date), I use a dataview query that excludes anything with a time in the description. @scholarInTraining was so kind to whip that up for me :blush:

	TASK
	WHERE !regexmatch("^\d{2}:\d{2}", text) AND !completed
	SORT file.mtime ASC

I didn’t know that the tasks plugin could do so much more than I thought, so most likely I could also get the same results with something like

description does not include :

Edit: that works, but not for anything with an outgoing link in it, because there always is a : in a link, of course.

I wouldn’t know how to tell the Tasks plugin with its native query method, to include or not include a time in the HH:mm format. Dataview can do that, see the query @scholarInTraining came up with.

If anyone does know if and how the Tasks plugin query can do the same, I would Love to know how!

FiekeB, that’s very creative - I’m so glad you got it working! Nice use of the calendar/periodic-notes templating: I am just figuring that out myself!

I think there is was a proposal or a discussion or something in Tasks about doing a regexmatch in the description, but I don’t believe it’s implemented yet! @ClareMacrae might know more. (Clare, this is a very nice use-case for regex matching in task text/description: including or excluding tasks that begin HH:mm!)

1 Like