Hi there! I’ve only been using Obsidian for about a week, but after genuine efforts to solve this myself, I’m still getting stuck. Apologies in advance for my lack of knowledge!
What I’m trying to do
Exactly what this poster in 2022 was trying to do: How can I list tasks from all notes with a certain tag (using the Tasks plugin)?
As an example, setting up my GTD system, I’d like to have an ‘inbox’ note, and use it as a brain dump space. I might have three tasks there:
- [ ] Use the beets in something #kitchen
- [ ] Pick up the mail #errands
- [ ] Learn how to use properties in Obsidian
And I’m now trying to make a note like:
---
tags:
- kitchen
- someday
- 🔼
- project
---
## Kitchen
```dataviewjs
const query = `
not done
${"(path includes " +
dv.pagePaths(tag).join(') OR (path includes ') + ")"}
# you can add any number of extra Tasks instructions, for example:
group by heading
`;
dv.paragraph('```tasks\n' + query + '\n```');
```
following the instructions (as best I can) from the 2022 post I mentioned. I want it to pull the task about using the beets to the #Kitchen note.
However, I get the following error:
Evaluation Error: ReferenceError: tag is not defined
at eval (eval at <anonymous> (plugin:dataview), <anonymous>:4:14)
at DataviewInlineApi.eval (plugin:dataview:18404:16)
at evalInContext (plugin:dataview:18405:7)
at asyncEvalInContext (plugin:dataview:18415:32)
at DataviewJSRenderer.render (plugin:dataview:18436:19)
at DataviewJSRenderer.onload (plugin:dataview:18020:14)
at e.load (app://obsidian.md/app.js:1:1147632)
at DataviewApi.executeJs (plugin:dataview:18954:18)
at DataviewPlugin.dataviewjs (plugin:dataview:19559:18)
at eval (plugin:dataview:19478:124)
Things I have tried
Once I first got that error, I then went into both the Kitchen and Inbox notes to define #kitchen as a tag. I also tried defining #kitchen as a tag separately on each of the notes, without it being defined on the other. Same error.
I’ve read through: How to get tasks in current file - Tasks User Guide - Obsidian Publish
I’ve also searched the forums, trying these solutions as well:
I have not tried the AlanG’s solution from the first link, since I’d like to build the query based on the tag itself (i.e. #kitchen), not the lack of all other tags.
I’ve looked through: Properties - Obsidian Help
but clearly I’m missing something, since the defining of the #kitchen tag hasn’t worked yet.
I think I need to at minimum define the #kitchen tag somewhere I haven’t thought of, maybe in a separate .js file in Dataview?
I’ve also tried to look into how to define tags once, globally in my vault, since I’ll also want to create an Errands note and pull all #errands tasks into it, etc. So defining once would be nice. I did find this related feature request:
I’m in the fortunate position of not yet having thousands of notes and hundreds of tags to wrangle or change, so am looking for a way to set this up correctly from the get-go.
Thanks so much for any help you can spare! Obsidian seems really great, and I’ve loved using it recently for the notes from a writing workshop I took. So easy to use for note taking, such clean and easy-on-the-eyes UI. I’m excited to get it set up for task management, too, and never have to look at something like Asana or ClickUp again.