Although I’m very new to creating these advanced queries, I got to the following code:
#+BEGIN_QUERY
{:title [:b "TODOs for Project X"]
:query [:find (pull ?child [*])
:in $ %
:where
[?parent :block/properties ?prop]
[(get ?prop :projects) ?proj]
[(contains? ?proj "Project X")]
(get-children ?parent ?child)
[?child :block/marker ?marker]
(not [(clojure.string/includes? ?marker "DONE")])
]
:rules [
[(get-children ?parent ?child)
[?child :block/parent ?parent]
]
[(get-children ?parent ?child)
[?t :block/parent ?parent]
(get-children ?t ?child)
]
]
}
#+END_QUERY
However, I would like to make a template having this query to automatically get all my tasks which are children from the blocks that have the property “projects” containing the value “Project X”.
Does anyone know how to make such a dynamic query.
I also tried :input and :in, but I cannot get the result i want.
Thanks in advance!
What are you exactly looking for?
What does the query currently not do that you want it to do?
Maybe provide an example of how you want things to be?
Is it just that you want the value Project X to be dynamic?
If so based on what input? (Page query is on, parent block of the query etc)
Thank you for your reply! I’ll provide more explanation.
For each meeting, I have a template that allows me to place my notes but also tasks as follows:
### Meeting title
projects:: [[Projects/Project X]]
tags::
date::
- **Notes**
-
- **Tasks**
-
Although maybe there might exist an easier way to do this. However, I’m not aware of such a possibility. That’s why I’m looking for a query that can be placed under “Tasks” that looks for all TODO/DOING/LATER tasks from other meetings associated with the same project (i.e. having the same value for the projects:: property).
The query should be able to take whatever value from the “projects::” property and look for meetings having the same value and retrieve the TODO/DOING/LATER tasks that are mentioned over there as a grandchild from that meeting under “Tasks”.
The meetings get placed under the daily journal notes under the block “Notes” like this:
2023-08-23 Wednesday
- ## Notes
- ### Meeting Project X
projects:: [[Projects/Project X]]
tags::
date::
- **Notes**
-
- **Tasks**
- TODO 1
- TODO 2
- ** Query
- This is the place I would like the query to be
- #+BEGIN_QUERY.............
I hope there is a way to query those tasks!
Please, let me know if this explanation is not sufficient!