Port Live Queries to Advanced Queries

I am trying to port the Task Overview of the starter kit from @Bassmann to advanced queries:

  • {{query (and (task TODO DOING LATER NOW IN-PROGRESS) (priority A))}}
  • {{query (and (task TODO DOING LATER NOW IN-PROGRESS) (priority B))}}
  • {{query (and (task TODO DOING LATER NOW IN-PROGRESS WAIT WAITING) (priority C))}}
  • {{query (and (task TODO NOW LATER DOING IN-PROGRESS) (not (priority A B C)))}}

The simple ones, which filter only the task and a single priorty, were no problem. But I got stuck at two points:

  • How can I ‘translate’ (not (priority A B C))?

  • In the simple query the page name is at the top, in the advanced query not.

Could somebody help me please with the ‘translation’?

Here is my solution for the first code block:

{:title [:h2 "🔨 Priorty A Tasks - Do now"]
    :query [:find (pull ?h [*])
            [?h :block/marker ?marker]
            [(contains? #{"TODO" "DOING" "LATER" "NOW" "IN-PROGRESS"} ?marker)]
            [?h :block/priority "A"]]
    :result-transform (fn [result]
                        (sort-by (fn [h]
                                   (get h :block/priority "Z")) result))
    :group-by-page? false
    :collapsed? false}

One way could be this:

(not [?h :block/priority "A"])
(not [?h :block/priority "B"])
(not [?h :block/priority "C"])

I assume you wanted to tag @Bas_Grolleman ? I’m still trying to understand Logseq myself sono starter kit I could have created :wink:

Sorry, that is correct. Damn auto-completion. :smiley:

1 Like