I’m looking for all oustanding tasks in my journal that have an ancestor block that has the string content “routine” in it (case-insensitive)
#+BEGIN_QUERY
{:query [:find (pull ?b [*])
:in $ ?s %
:where
[?b :block/marker ?marker]
[(contains? #{"TODO"} ?marker)]
;; ancestor is true when ?ancestor is an ancestor of b
((ancestor ?b ?ancestor)
[?ancestor :block/content ?str]
[(clojure.string/includes? ?str ?s)]
)]
:inputs
["routine" [[[ancestor ?b ?ancestor]
[?b :block/parent ?ancestor]]
[[ancestor ?b ?ancestor]
[?child :block/parent ?ancestor]
(ancestor ?b ?child)]]]
}
#+END_QUERY
Thank you in advance for your help.