I am been working on this for hour but still couldn’t get it working. I’d like to group the result by both the page name and the marker so I can see how many todos how many doings etc
#+BEGIN_QUERY
{:title [“Project TODO List”]
:query [
:find (pull ?b [
{:block/page [:block/name ]}
:block/content
:block/marker
]
)
:in $ ?in
:where
[?b :block/marker ?marker]
[?b :block/page ?p]
[?p :block/name]
[?p :block/properties ?prop]
[(get ?prop :category) ?v]
(or [(= ?v ?in)] [(contains? ?v ?in)])
[(get ?prop :status) ?t]
[(= ?t “wip”)]
[(contains? #{“NOW” “LATER” “TODO” “DOING”} ?marker)]
]
:inputs [“project”]
:result-transform (fn [result]
(map (fn [[key value]] {:page (get key :block/name) :progress (get value :block/marker) :count (count value)}) (group-by [:block/name :block/marker] result))
)
:collapsed? false}
#+END_QUERY
What it currently returns is this and I can’t click anywhere to get to the page, its also not readable
{:block/content “TODO create a training schedule”,
:block/marker “TODO”,
:block/page {:block/name “training for marathon”}}
{:block/content “DOING 10K steps a day”,
:block/marker “DOING”,
:block/page {:block/name “training for marathon”}}
{:block/content “TODO look into different meal options”,
:block/marker “TODO”,
:block/page {:block/name “training for marathon”}}