Hi,
this is the first time I’m trying a query but I am not getting the results I need… yet
What I want to do:
have a template for my journal where there is a query that picks up on all the to-do’s that weren’t done on the previous journal page.
first question: is there a variable that targets the previous existing journal page? if not, I would just qo with 3days ago, so that it also works on a Monday
second question: how would the query look like? I have searched around and pieced together this query
#+BEGIN_QUERY
{
:title "Journal Tasks"
:query [
:find (pull ?h [*])
:in $ ?start ?today
:where
[?h :block/marker ?marker]
[?h :block/page ?p]
[?p :page/journal? true]
[(contains? #{"LATER" "NOW" "TODO" "DOING"} ?marker)]
]
:inputs [:10d-before :today ]
:collapsed? false
}
#+END_QUERY
This is not yet complete but the functionality of getting to-do’s from journal page is working.
So the part that I’m struggling with is adding the time-range. I tried adding these two lines:
[(>= ?p ?start)]
[(<= ?p ?today)]
which makes my query look like this:
#+BEGIN_QUERY
{
:title "Journal Tasks"
:query [
:find (pull ?h [*])
:in $ ?start ?today
:where
[?h :block/marker ?marker]
[?h :block/page ?p]
[?p :page/journal? true]
[(>= ?p ?start)]
[(<= ?p ?today)]
[(contains? #{"LATER" "NOW" "TODO" "DOING"} ?marker)]
]
:inputs [:10d-before :today]
:collapsed? false
}
#+END_QUERY
But then it returns “No matched results”.
Can someone spot the error?