Hi all. I’m trying to identify what projects have no tasks tagged as “next”. Escapes my rudimentary understanding of queries:
List of all pages that do NOT appear on a block that has the following 3 characteristics (third one is an OR):
1-task with status other than CANCELED, DONE
2-contains page reference [[next]] on the very block, NOT inherited from a parent.
3- has the page reference [[project/…]] (any within the namespace) (inherited or not)
OR
has a page ref (inherited or not) which has a property “area” = [[family]] or [[health]]
Thanks for your help!
Apologies for the delayed response.
CLARIFICATION:
- The output I’m looking for is a list/table of project page names I can click on.
CONTEXT:
- All projects have page names as follows [[project/project name]] or project/project name/subproject name]].
- There’s multiple TODOs assigned to each project. However, only 1-2 tasks per project are really the next actions to take. I tag these TODOs with [[next]], in addition to the specific project page ref.
- I have various queries that tell me what [[next]] actions are available for me to do.
PROBLEM:
- I don’t have a way to know which projects DON’T have any tasks tagged as [[next]]. If I did, I could selectively go to those specific project plans and make sure 1-2 tasks are always tagged as [[next]] so they can continue moving forward.
REQUEST: I would like a query that will give me a list of project page names that don’t have any tasks (not canceled or done) tagged as [[next]].
- 1-task with status other than CANCELED, DONE
- 2-contains page reference [[next]] on the very block, NOT inherited from a parent.
- 3- has the page reference [[project/…]] (any within the namespace) (inherited or not)
OR
has a page ref (inherited or not) which has a property “area” = [[family]] or [[health]] For simplicity, disregard this OR.
Something like this:
#+BEGIN_QUERY
{
:query [:find (pull ?project [*])
:where
[?project :block/name ?name]
[(clojure.string/starts-with? ?name "project")]
(not
[?b :block/refs ?project]
[?b :block/marker ?marker]
(not [(contains? #{"CANCELED" "DONE"} ?marker)])
[?b :block/refs ?next]
[?next :block/name "next"]
)
]
}
#+END_QUERY
1 Like
Just added the forward slash “project/” so it would not display page names that contained the word “project” and it works great. How would we filter out the following results from the list?
- “status” property is canceled or done.
- “status” property is empty.
- No “status” property at all.
This was my attempt. It’s displaying the same results.
#+BEGIN_QUERY
{
:query [:find (pull ?project [*])
:where
[?project :block/name ?name]
[(clojure.string/starts-with? ?name "project/")]
(not
[?b :block/refs ?project]
[?b :block/marker ?marker]
(not [(contains? #{"CANCELED" "DONE"} ?marker)])
[?b :block/refs ?next]
[?next :block/name "next"]
(not
[?p :block/properties ?props]
[?props :status ?status]
(not [(contains? #{"" "CANCELED" "DONE"} ?status)])
)
]
}
#+END_QUERY
Rather use these lines:
[?p :block/properties ?props]
[(get ?props :status) ?status]
(not [(contains? #{"" "CANCELED" "DONE"} ?status)])