TODOs with upcoming deadline for next 5 days

I am using below query to find all the TODOs which have a deadline of today but I want to write it in such a way so that even if Task is Done it should be visible and I want all the queries which have a deadline within next days. Please help me if someone can

{:title [:h2 "⏰ Deadline Today"]
 :query [:find (pull ?block [*])
   :in $ ?day
       [?block :block/deadline ?d]
     [(= ?d ?day)]
     (or-join [?block] 
         [?block :block/marker ?marker]
         (not [(contains? #{"DONE" "CANCELED"} ?marker)])
       (not [?block :block/marker])
 :inputs [:today]
 :breadcrumb-show? false


For next 5 days, you need:

  • :inputs like this:
    :inputs [:today :+5d]
  • :in like this:
    :in $ ?day ?next5
  • then replace this condition:
    (= ?d ?day)
    with one like this:
    (between ?block ?day ?next5)

See also here and here.

This is working fine. Thanks for your quick response


This is actually not the same. This says the block has to be on the journal between those dates.
Instead it needs to be: [(<= ?day ?d ?next5)]


1 Like

I didn’t notice that. Thanks for the update

1 Like