Show the "SCHEDULED" date as a column in query's table view

If you use the SCHEDULED feature to schedule your tasks and then query them, you do not see the SCHEDULED property in the table view.

It will be very helpful to be able to see the scheduled (and in extension, DEADLINE) in the table view.

This is because it is not actually a property. We can add it using advanced queries though.

#+BEGIN_QUERY
{:title "scheduled"
 :query [:find (pull ?b [*])
   :where
     [?b :block/scheduled _]
 ]
 :result-transform (fn [result] (map (fn [m] (update m :block/properties (fn [u] (assoc u :sched (get-in m [:block/scheduled]) ) ) ) ) result ) )
}
#+END_QUERY

4 Likes

Thanks @Siferiax!

This looks good. However, I would also prefer to be able to click on the date to modify, if required. Also, the date formatted like this is not very readable. I think I can format the date in the query though.

I can keep using this query for the meanwhile. Thanks a lot!

That’s not possible. It is just a number being shown. You can only edit it if you return the actual block and not just a value.

Again, it’s just a number as how it is stored in the Logseq internal database.
So you can convert it to string with (str ) and use (subs ) to break it down. Then (str ) to put it back together how you want.
But there’s no true date parsing as it isn’t a date. And queries don’t support dates anyway it seems.
Documentation for the functions mentioned can be found here: https://clojuredocs.org/