How can I create a time-spent-on-tasks report for a tree of tasks or single page of tasks?

To limit the results under a block of specific uuid (right-click on its bullet then Copy block ref):

  • add a recursive rule like this:
    :rules [
    	[(ancestor ?a ?b)
    	 [?b :block/parent ?a]
    	]
    	[(ancestor ?a ?b)
    	 [?b :block/parent ?t]
    	 (ancestor ?a ?t)
    	]
    ]
    
    • add % at the end of :in , to indicate that :rules are applied, so in total either:
      • :in $ ?page-name % , if :inputs [:query-page] is used
      • :in $ % , if :inputs [:query-page] is not used (i.e. missing)
  • use the rule to replace
    • these lines:
       [?p :block/name ?page-name]
       [?b :block/page ?p]
       [?b :block/marker]
      
    • with these ones:
       [?root :block/uuid ?uuid]
       [(str ?uuid) ?str]
       [(= ?str "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX")] ; use actual uuid
       [?b :block/marker]
       (ancestor ?root ?b)
      
      • Replace XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX with the uuid of the desired block.