How to query pages with at least a pending task?

Hello Hello,

I would query all the pages where there is at least a “TODO” … and I don’t know how to do it :smile:

I can get the list of the tasks, group them by pages, but this is not what I’m looking for.

My scenario is to use a page as a “Topic” which sometimes includes an action (let’s say “anniversary” page may have a task to buy a gift for the upcoming ones)
With the list of page, I will be able to hover page names and read the actions on the page ( top section)

Simple query does not seem to answer this and I’m not good enough with advanced queries :face_with_open_eyes_and_hand_over_mouth:

Thanks in advance for any pointer or hint :smiley_cat:
Anne.

Something like this:

#+BEGIN_QUERY
{:title "Pages with TODOs"
 :query [:find (pull ?p [*])
   :where
     [?b :block/page ?p]
     [?b :block/marker ?marker]
     [(contains? #{"TODO"} ?marker)]
 ]
}
#+END_QUERY
1 Like

Hello mentaloid,

So elegant … :star_struck:

Didn’t expect to get the answer faster than a pizza delivery :joy: you made my day :bowing_man:

Cheers,
Anne.

1 Like

I personally prefer to just open the TODO page and all todo’s will be there in linked references.

1 Like