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

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

Welcome.

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

@Bhavuk_Sharma

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)]

See: https://docs.logseq.com/#/page/650b2587-bf16-4b9a-947b-145978c01c93

1 Like

I didn’t notice that. Thanks for the update

1 Like