How to create independent output rows (no child) for EACH task that meets these conditions?

:woman_facepalming:t4: that’s my fault I’m sorry. I just got it to work, not including all required columns.
I was trying to find a good example and… I can’t find it :sweat:
I’ll get back to you…

Here’s an example… It’s a different query, so it uses the find keys. It’s not on my website yet, but there are comment on it already.
I’ve manually added marker in for you. Hopefully I didn’t make a mistake :joy:

#+BEGIN_QUERY
{:title [:h4 "🎯 Deze week"]
 :query [:find (pull ?b [*]) ?sched ?dead ?m ; return the block and the sched and dead variables
  :keys block sched dead mark ; give the find values a key for use in result-transform
  :in $ ?day ?today
  :where
   ; Add the criteria for which `?b` you want to find here. I've added all tasks as an example.
   [?b :block/marker ?m]
   (not [(contains? #{"DONE" "CANCELED"} ?m)] )
   [(get-else $ ?b :block/scheduled "-") ?sched] ; get the attribute or "-"
   [(get-else $ ?b :block/deadline "-") ?dead] ; get the attribute or "-"
 ]
 :result-transform (fn [res] 
   (sort-by ; Any sort field here.
     (juxt 
       (fn [r] (get r :block/scheduled 99999999))
       (fn [r] (get r :block/priority "X"))
       (fn [r] (get r :block/deadline 99999999))
       (fn [r] (get r :block/content))
     )
     (map (fn [m] ; make a new map based on the query result
       (update (:block m) :block/properties ; update the block properties
         (fn [u] (assoc u :scheduled (get-in m [:sched]) :deadline (get-in m [:dead]) :marker (get-in m [:mark]) ) ) ; associate the sched and dead values set in the where clause
       )
     ) res)
   )
 )
 :breadcrumb-show? false
 :inputs [20230604 :today]
}
#+END_QUERY
1 Like