How to exclude tasks from today Journal from my Adv. QUERY?

:heart: Thanks a Lot Folks! :heart:
You Guys Rocks

Still with a few redundancies and somewhat ambiguous (e.g. I don’t get how a task in today’s journal is not created today), but otherwise very helpful. This attempt is commented:

mentaloid, i’ve tested your query but for some reason it didn’t worked as expected, it ended just showing the the A priorities tasks and forgot all the other ones. I’m really grateful for your time and efforts toward this :smiling_face:

Siferiax, your query almost worked out-of-the box :rocket:!! For some reason I had to disable the

[?block :block/deadline ?dd]

to make it work properly, if i kept it in the code it would show scheduled tasks for the future, so I make it as a comment and the query it’s already functional, since I do not use the deadline function.

But I’m so close to the final result that it makes me super happy :slight_smile:

This is what i’ve done, took the Siferiax approach and added a comment on the line mentioned

#+BEGIN_QUERY
{
 :title [:h6 " 📝Task Scraper"]
 :query [:find (pull ?block [*])
   :in $ ?today
   :where                                  ; scan everywhere for all
     [?block :block/marker ?marker]        ; blocks of specific markers
     [(contains? #{"LATER" "TODO" "DOING" "WAITING"} ?marker)]
     (or-join [?block ?today]       ; which are either
       [?block :block/priority "A"]        ;   any top-priority blocks
       (and                                ; or blocks that are
         [?block :block/path-refs ?br2]
         [?br2 :block/name "tasks"]        ;   tasks
         (not                              ;   not
           [?block :block/path-refs ?br1]
           [?br1 :block/name "ignore"]     ;     ignored
         )
         (or-join [?block ?today]          ;   and either
           (and
             [?block :block/scheduled ?sd] ;       scheduled for
             [(<= ?sd ?today)]             ;       before tomorrow
           )
           (and                            ;     or
             [?block :block/deadline ?dd]  ;       ending
             [(<= ?dd ?today)]             ;       before tomorrow
           )
           ;or not scheduled and not deadlined
           (not  
             [?block :block/scheduled ?sd]
             ;[?block :block/deadline ?dd] ; Made the fix here to make it work
           )
         )
         (not                              ;   but not
           [?block :block/page ?j]   ;     Located on page
           [?j :block/journal-day ?today]               ;     today's journal
         )
       )
     )
 ]
 :inputs [:today]
 :result-transform (fn [result]
   (sort-by
     (fn [h]
       (get h :block/priority "Z")
     )
     result
   )
 )
 :collapsed? false
 :breadcrumb-show? false
}
#+END_QUERY
2 Likes