Yeah, that’s basically the issue. Jesse’s is like the final example in the Query docs where if you put the whole expression in parens you get one next action instead of one per project. I want one per parent project.
To be clearer, if I have:
Project Foo:
- Task 1
SubProject A:
- Task 1
- Subtask a
- Subtask b
- Task 2
- Subtask a
- Subtask b
SubProject B:
- Task 1
- Subtask a
- Subtask b
- Task 2
- Subtask a
- Subtask b
…then I want it to pick Foo-1, Foo-A-1-a, and Foo-B-1-a. In other words, the first childless task found under each project. These would be my next actions assuming any subproject can be done in parallel with its siblings, but subtasks cannot. I use this setup a lot, coming from OmniFocus.
In Xpath I’d do this with a node predicate of no children i.e., //*[not(*)]
, but the bracket constructs to test for attributes/parent/child/etc aren’t part of FT/TP as far as I can tell. We have attribute tests broken out into the = syntax, but no way to test for parentage.
Instead, to select nodes based on parentage you have to do something like *//*/child::*/parent::*
which effectively gives you all nodes with children by dipping down and back up.
But that technique doesn’t work when you’re trying to select something without children at all, and I’m guessing this is a clear gap in the query syntax.
Complexpoint’s script will work, but being able to select a leaf node is important enough in xpath selectors that I hope we might find a built-in solution here too for the same reasons. It’s also how I would select Projects with no next actions under them for review, and a few other things like that.
Edit: fixed example tabbing, I hope.