How to show page title in table view mode by using advanced query

There’s an alternative way thanks to Darwis on discord:

Makes the query a bit more concise and allows for the default table view usage.
I took their example from discord and applied it to the query I made for this thread.

The query basically adds another property to the block so it can be used in the table view.

:journal is what is used as a name for page. Please be aware that :page is reserved and doesn’t work.

#+BEGIN_QUERY
{:title "All blocks with tag inbox"
   :query [:find (pull ?b [*])
         :where
         [?i :block/name "inbox"]
         [?b :block/refs ?i]
  ]
  :result-transform (fn [res] (sort-by (fn [s] (get-in s [:block/properties :journal-day])) > (map (fn [m] 
       (update m :block/properties 
           (fn [u] (assoc u :journal-day (get-in m [:block/page :block/journal-day]) :journal (get-in m [:block/page :block/name]))
           ))
    ) res)))
 }
 #+END_QUERY

PS. Also check out this feature request!

2 Likes