Advanced query for a tag in journal pages


I try to make a query with all the blocks with the tag +meeting for the next 7 days ordered from the oldest to the newest date in journal. The query is in the +meeting page.

I use this query, but it shows the result not in the way I need it (not a table and showing the blocks).

This is the code:

	  {:title [:h3 "๐Ÿ—“ Meetings 7 days"]
 :query [:find (pull ?p [:block/name :block/journal-day])
          :in $ ?start ?next
             [?p :block/name ?current-page]
             [?p :block/journal-day ?d]
          [(>= ?d ?start)]
          [(<= ?d ?next)]
 :inputs [:today :7d-after]
:result-transform (fn [result] (sort-by (fn [r] (get-in r [:block/name :block/journal-day])) result ))
      :breadcrumb-show? false
       :group-by-page? true
       :table-view? false
	   :collapsed? false

and this is the result

What is wrong?
Thanks in advance for your support!

There is much going on, so letโ€™s list some observations:

  • Your ?p, having a :block/name, is a page itself, not a block within another page.
    • So the results are (journal) pages, not common blocks.
      • If thatโ€™s part of the issue, could begin fixing it with something like [?b :block/page ?p]
  • Your ?current-page is neither used nor corresponds to the current page.
    • You may want to include :current-page inside :inputs [ ]
  • The result is not sorted in a meaningful way.
  • Your lines after :result-transform are probably not needed.
  • There is no mention of +meeting inside the query.

Maybe begin with something simpler/easier that works, then try adding to it one thing at a time.