I have many pages with mytag
on them. I would like to list all tasks from these pages, but I only want the first task of a given page. When I get it done, the next one should appear in the query result. This is what I got so far
#+BEGIN_QUERY
{:title "First task on on pages with tag MYTAG"
:query [:find (pull ?b [*])
:where
[?b :block/marker ?marker]
[(= "TODO" ?marker)]
[?b :block/page ?p]
[?p :block/tags [:block/name "mytag"]]
]
:view (fn [result]
(for [x (reduce-kv (fn [m k v]
(assoc m k [(first v)]))
{} result)]
RENDER-X))
}
#+END_QUERY
I am filtering the first task in the view
(I don’t know if there is a way to do that on the query
. But I couldn’t find a way to render the items nicely as I could have not using views
(i.e. default way to render).
Quesitons:
- Is there a way to limit the first result as part of the query?
- If (1) is not possible, how do I use the default renderer in the view function?