Advanced query to search TODOs in active projects

Here is a query to begin with:

#+BEGIN_QUERY
{
 :query [:find (pull ?block [* ])
 :in $ %
 :where
   [?block :block/page ?page]
   [?block :block/marker ?marker]
   [(contains? #{"TODO"} ?marker)]

   (ancestor ?a ?block)
   [?a :block/properties ?props]
   [(get ?props :status) ?status]
   [(= ?status "active")]
 ]
 :inputs [
   [
     [
       [ancestor ?a ?b]
       [?b :block/parent ?a]
     ]
     [
       [ancestor ?a ?b]
       [?parent :block/parent ?a]
       (ancestor ?parent ?b)
     ]
   ]
 ]
}
#+END_QUERY

The exact format of your notes is unclear, so you may need to add/remove parts from/to that query.

1 Like