Sort NEXT queries by block/journal-day

Even when customizing the default queries, I see no change when sorting by journal date with the below code:

result-transform (fn [result]
                        (sort-by (fn [h]
                                   (get h :block/journal-day)) result))

If the output is a block. That is, :find (pull ?b [*]) with ?b being a block. (for example [?b :block/page ?p] block ?b on page ?p) Then the journal-day is nested within the :block/page attribute.
:result-transform then becomes:
:result-transform (fn [result] (sort-by (fn [h] (get h [:block/page :block/journal-day])) result))
Only works if the block is on a journal page though.

I wasn’t able to get that to work, but I got the following to work:

:result-transform (fn [result]
   (sort-by (fn [h]
   (get-in h [:block/page :block/journal-day])
)))
1 Like

Hah lol yes. I forgot the in there :face_holding_back_tears: