What I wanted was the ability to move a task forward in time through scheduled, but without moving the deadline. However I didn’t want to see these in my tasks for today query anymore. (tasks for today are all those with scheduled or deadline in the past or on today)
#+BEGIN_QUERY
{:title [:h3 " ⚡ Vandaag"]
:query [:find (pull ?b [*])
:in $ ?day
:where
[?b :block/marker ?m]
[(contains? #{"TODO" "DOING"} ?m)]
[?b :block/page ?p]
(or-join [?b ?d]
[?b :block/scheduled ?d] ; scheduled on ?d
(and
[?b :block/deadline ?d] ; or deadline on ?d
(not [?b :block/scheduled]) ; and not scheduled
)
(and
[?b :block/deadline ?d] ; or deadline on ?d
[?b :block/scheduled ?t] ; and scheduled on ?t
[(<= ?t ?d)] ; and ?t is less or equal to ?d
)
)
[(<= ?d ?day)] ; ?d is less or equal to ?day, which is set to today.
[?b :block/parent ?pb] ; the parent of the task
(not [?pb :block/marker "TODO"]) ; the parent is not a task. I.e. filter out subtasks.
]
:result-transform (fn [result] (sort-by
(juxt
(fn [r] (get r :block/scheduled 99999999)) ; sort by scheduled, which is substituted by 99999999 when it doesn't exist, meaning unscheduled tasks end up at the bottom instead of the top.
(fn [r] (get r :block/deadline)) ; and then sort by deadline.
)
(map
(fn [m] (assoc m :block/collapsed? true)) ; collapse the result blocks
result
)
) )
:table-view? false
:breadcrumb-show? false
:inputs [:today]
}
#+END_QUERY
similar to Tasks for today based on scheduled or deadline, but without the deadline and just either tasks scheduled today or not scheduled at all on the current page:
Hi, is it possible to for any of the queries in your OP to generate a table view of all my tasks with columns for project, deadline, priority, etc? Then can I filter and sort this table by the column values? Thanks in advance!
This is partially possible and depends on what you are looking for exactly.
For example the query under the header
Generates a table. See the :view part of the query.
Please post some example data and desired result and I’ll have a look!
Do be aware that you will not be able to filter and sort the table by the column names though. The query will just give you a static result.
Hi, this has been such a useful resource. Thank you!
I am starting with your “Tasks without a specific page link” and modified it a bit. I have breadcrumbs as false but I still end up getting the references for the tasks that I am pulling. Here is the code that I have
#+BEGIN_QUERY
{:title [:h3 "Tasks without page reference" ]
:query [:find (pull ?b [*])
:where
[?p :block/name "habit-tracker"] ; name is always lowercase
[?b :block/marker "TODO"]
(not [?b :block/scheduled])
(not [?b :block/deadline])
(not [?b :block/refs ?p]) ; we cannot use not until we have specified the variables used in it
]
:table-view? false
:breadcrumb-show? false
}
#+END_QUERY
I believe this is a solution for the issue: :result-transform and grouping of results · Issue #6641 · logseq/logseq · GitHub
Which a lot of people have asked for / complained about. (myself included lol, even though I often used result-transform to get rid of it)
There should be a way to remove the grouping, but I’m unaware if this is now available or not.
Created a feature request topic for it: