First time poster, please forgive me if I break some rules, but I think I’m legit.
What I’m trying to do
I’m trying to include only the first task with a tag of #nextAction from projects if it isn’t completed. I may have multiple #nextActions in the list. For Example.
- [ ] Action 1
- [ ] Action 2
- [x] Action 3 #nextAction
- [ ] Action 4 #nextAction
I only want it to return action 4
Things I have tried
I’ve searched the forums, loaded the Example Vault and even tried ChatGPT. I’m still pretty new to this
Here is test query 1.
This is the closest I have come to succes. This returns multiple lines for the same file. One for each tag that contains #nextAction
Table
file.name,
replace(nextAction.text, "#nextAction", "") as "Next Action"
From
"Test_Projects"
flatten file.tasks as nextAction
Where
nextAction.completed = false AND
contains(nextAction.text, "#nextAction")
Here is test query 2.
This only returns a result if the first task has the tag and is unchecked.
Table
file.name,
replace(nextAction.text, "#nextAction", "") as "Next Action"
From
"Test_Projects"
flatten file.tasks[0] as nextAction
Where
nextAction.completed = false AND
contains(nextAction.text, "#nextAction")