Manually add custom block in advanced query

Hi there,

I am fiddling with my default queries on the journal page and want to reduce the number of items in the “NEXT” query. I was successful in reducing the number by (take 5), but now I want to add a hint, that there are more tasks left.

I tried to create a custom block using :result-transform using :block/content and :block/format, but apparently the queries don’t really care about anything but :block/uuid and :db/id.

(Anything without these will be ignored and everything else in the original queried block will be ignored either. I can remove everything in :result-transform but these two and it will continue to display correctly.)

Do you have any ideas how I can change this so this actually adds my custom item to the view?

 :result-transform (fn [r] (->> r
        (map (fn [m] (assoc m :block/collapsed? true)))
        (sort-by (fn [d] (get d :block/scheduled)))
        (take 5)
        ((fn [s] (conj s { :block/format :markdown,
                                 :block/content "And N more items..." })))))
         
         
  • There is no built-in way to do that through :result-transform
    • It could be possible to hack something, but probably not worthy.
  • The built-in way to change the view is through :view
    • But this skips the default renderer and goes full-custom.
  • Could instead use two queries:
    • one to list the top 5 items
    • one to count and print the total number of the results

Thank you for clarifying :slight_smile: