Reverse the order of todos in Journale

Hello

Following query Lists all todos of the next 42 days in my journal. But the order does not fit, because the todo with the farthest deadline is at the first place and the closest todo is at the last place. What do I have to do, that the order is the other way round?

This is the current query:

(get h :block/priority “Z”)) result))
:collapsed? false}
{:title “:date: NEXT”
:query [:find (pull ?h [*])
:in $ ?start ?next
:where
[?h :block/marker ?marker]
[(contains? #{“NOW” “LATER” “TODO”} ?marker)]
[?h :block/ref-pages ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(> ?d ?start)]
[(< ?d ?next)]]
:inputs [:today :42d-after]
:collapsed? false}]}

Thanks

uwe

Please refer to this topic for sorting based on deadline:

Let me know if you need more help!

Hello Siferiax,

Thanks for your help. With your examples i was able to fix the Problem. I used the following query:

(get h :block/priority “Z”)) result))
:collapsed? false}
{:title “:date: NEXT”
:query [:find (pull ?h [*])
:in $ ?start ?next
:where
[?h :block/marker ?marker]
[(contains? #{“NOW” “LATER” “TODO”} ?marker)]
[?h :block/ref-pages ?p]
[?p :block/journal? true]
[?p :block/journal-day ?d]
[(> ?d ?start)]
[(< ?d ?next)]]
:result-transform (fn [result]
(sort-by (fn [h]
(get-in h [:block/page :block/journal-day]))
result))
:inputs [:today :42d-after]
:collapsed? false}]}

uwe

1 Like