Hello everyone, new LogSeq user here. I have some experience writing code, so this isn’t too far off from what I know. That said, I’m having some difficulty understanding how to do a query based on a property simply existing and then displaying the results in a list that is sorted by date and then the property value.
Here is a simple query that does what I want, but doesn’t work in table format due to the actual TODO item not being displayed in the table: (It does display when in list view.)
{{query (and (between <% today %> +5d) (property :time) (sort-by))}}
Screenshot:
Here is an advanced query that partially gets me there, but it isn’t showing the time property at all and also isn’t filtering anything prior to today, so the filter isn’t quite working.
#+BEGIN_QUERY
{ :title "Tomorrow Advanced"
:query [:find (pull ?b [*])
:in $ ?today ?tomorrow
:where
[?b :block/marker ?m]
(not [(contains? #{"DONE" "CANCELED"} ?m)])
[(get-else $ ?b :block/scheduled ?tomorrow) ?d]
(or
[(= "TODO" ?m)]
[(>= ?d ?today)])]
:inputs [:today :1d-after]
:result-transform (fn [result]
(sort-by (fn [h]
(get-in h [:block/scheduled])) result))
:breadcrumb-show? false}
#+END_QUERY
I’m not entirely sure how to both check that the property simply exists (the values will always be some kind of 24-hour time, but as a string since I don’t see a time formatting tool besides /Current-Time) and then while showing that + the TODO block and page it’s on sort out the TODOS by the time listed as show in the simple query screenshot.
The goal is to get what I have in the 1st screenshot, but into a table format if possible. If not, I’ll settle for the list as that is better than nothing at all. Any advice on what I can do without using a plugin? (I’m wanting this to be compatible with my phone as well as my laptop.)