Show query results without dividing by page

I am using this query to pull tasks from my entire graph:

{{query (todo TODO now doing) (sort-by created-at desc)}}

It works, but it separates the results by page, applying the sort within each. What I would like is one long, sorted list, without being divided by page. Is that possible?

Just beat my head against the wall for a few hours trying to figure this out. Give this a try. It’s sorted by most recently updated TODO blocks, but you can also replace “:block/updated-at” with “:block/created-at” or":block/priority" or however you want to sort. To sort ascending, just remove the reverse function and its corresponding parentheses.

#+BEGIN_QUERY
{:title "All tasks"
 :query [:find (pull ?b [*])
     :where
     [?b :block/marker ?m]
     [(contains? #{"TODO" "now" "doing"} ?m)]]
:result-transform (fn [result]
     (reverse(sort-by (fn [h]
             (get-in h [:block/updated-at])) result)))
:breadcrumb-show? false}
#+END_QUERY
3 Likes

I’m using Version 0.5.8
I think the results of advanced queries do not use the breadcrumb-show anyways? At least setting :breadcrumb-show? true doesn’t change anything for me.

EDIT: It seems, like the page-grouping (breadcrumbing?) breaks as soon as we sort, which actually might make sense.

This particular :result-transform function causes breadcrumbs to appear above every task that has a (non-task) parent block. These breadcrumbs list every block hierarchically above the task, though not the page the task is on. So if tasks are top-level blocks, no breadcrumbs will appear in this query, but if they’re not, they’ll have breadcrumbs, which is why I had to include the :breadcrumb-show? line.

EDIT:
ezgif-3-7e95a645e7

1 Like