Find all scheduled blocks that are NOT a TODO item

Hi,

I’m looking for a query to find all blocks that are scheduled (or have a deadline) for the current date that are not a task (TODO, LATER, ect. )

What I want to achieve is to schedule information to show up at certain dates or intervals etc.

Can someone point me in the right direction here ?

Thanks a lot,
Mari0

1 Like

Welcome. Since you asked for directions (instead of a direct solution):

Then use a not expression to exclude:

  • basic queries: task
  • advanced queries: marker

If still in troubles, ask back here (preferably with your progress).

Ok, I was able to get a 90% solution.

What is my starting point:
Bildschirmfoto 2023-10-24 um 10.56.13

I only want to see the Blocks “Test 1” and “Test 2” in my result.

My current query is this:

{:title [:b "Relevant Today"]
 :query [:find (pull ?b [*])
  :in $ ?day
  :where
   (or
     [?b :block/scheduled ?day]
     [?b :block/deadline ?day]
   )
 ]
 :inputs [:today]
}

But this one delivers also “Test 3” as result.

I’m not getting the point how to exclude TODOS explicitly.

What am I missing ?

Thanks,
Mari0

Well done so far. You miss the last step:

To exclude blocks that contain any marker, after the or-clause should add this line:

(not [?b :block/marker])

Ok, that was my mistake. I’ve always put this part before the or-clause.

So this is the final version and it works as expected:

{:title [:b "Relevant Today"]
 :query [:find (pull ?b [*])
  :in $ ?day
  :where
   (or
     [?b :block/scheduled ?day]
     [?b :block/deadline ?day]
   )
   (not [?b :block/marker])
 ]
 :inputs [:today]
}
2 Likes