Using dynamic variables in queries

Hi there

Is it possible to use dynamic variables like <%today%> in a simple query?

For example: I want to include a query which takes all todos for the actual dates in my jorunal page. i want to include this query in my journal tempalte and get all tasks of the day “every day”. A task of the day should be scheduled for this day…

thanks

Have you checked this?

To answer your question: yes it is possible. But even better, take the Simple Query as is and place it into an Advanced Query syntax (<query) and now you can give it a title and so on. I have done this with all my simple queries:

#+BEGIN_QUERY
{
:title [:h2 "Morning Routine:"]
:query (and [[Morning Routine]] <%today%>)
}
#+END_QUERY

Hope it helps.

hi

i’ve tried this:

#+BEGIN_QUERY
{
:title [:h4 "Tasks Scheduled Today"]
:query (and (task todo) [[May 7th, 2024]])
}
#+END_QUERY

and with this in a template:

#+BEGIN_QUERY
{
:title [:h4 "Tasks Scheduled Today"]
:query (and (task todo) [[May 7th, 2024]])
}
#+END_QUERY

The problem is, that when i use “today” in the query once, it functions properly. But when i use the template, the reference to the journal page is inserted and then i get an invalid query? Kind of pagereference to journal seems not to function.

Is this a real problem or just syntax stuff?

what i finally want, is display all task todos which are scheduled today. /scheduled…

i also tried this:

{{query (and (task todo) (between yesterday tomorrow)) }}

this works kind of good. but displays all todos not only the scheduled.

kind regards