Creating a query for overdue tasks

Hi,
I have a tasks page (Taakjes) which has a list of recurring tasks in it. These have a scheduled property and are set to repeat in daily, weekly or monthly intervals.
What I’m trying to do is get a list of open tasks, specifically those that have a schedule date that is now in the past.

At first I ran into the issue that the tasks are not in the journal pages and the between query only looks at the journal page dates.
But now I run into the issue that it isn’t pulling tasks with a schedule date in the past.

Here’s the query I have so far, mainly altered a query from the advanced queries documentation page.

#+BEGIN_QUERY
{:title “overdue scheduled tasks”
:query [:find (pull ?block [*])
:in $ ?start ?next
:where
[?block :block/scheduled ?d]
[(> ?d ?start)]
[(< ?d ?next)]]
:inputs [:30d :1d-after]
:collapsed? false}
#+END_QUERY

It successfully pulls tasks from the Taakjes page and not just the journal pages. But it only pulls tasks that are scheduled for today. Not those in the past.

So is what I want even possible?
Any suggestions of what I’m doing wrong, or else maybe a workaround?

I was being an idiot and figured out my dates for the tasks were incorrect! So it already does what I want in the journal pages automatically and the query I already had also works just fine :slight_smile:

1 Like