Please your support with the following advanced query

Dear All, I’m trying to get the blocks that are TODO and have a property type with value task that are not done or compeleted.

I’m having no luck, so far I’ve tried the following:

#+BEGIN_QUERY
{:title “Open Tasks”
:query [:find (pull ?b [*])
:where
[?i :block/type “task”]
[?b :block/marker “TODO”]
[?b :block/refs ?i]
[?b :block/page ?p]
[?b :block/uuid ?id]
[?b :block/content ?block]
[?p :block/original-name ?page]
]
}
#+END_QUERY

I’ll greatly appreciate any help

Best regards,

Javier

Welcome. Try something like this:

#+BEGIN_QUERY
{:title "Open Tasks"
 :query [:find (pull ?b [*])
 :where
   [?b :block/marker ?m]
   (not [(contains? #{"DONE" "CANCELED"} ?m)])
   [?b :block/properties ?prop]
   [(get ?prop :type) ?type]
   [(= ?type "task")]
 ]
}
#+END_QUERY
1 Like

Amazing, it works. Thanks a lot friend