Problem with using hashtags in tasks for dataview-query

Hi guys,

my workflow during daily work is like this:

In every project I’m working on, I have one obsidian-project-note, which is split in two sections:

  • Section1: 2 dataviews, one for my milestones in that project and one for my todos in that project
  • Section2: a protocol, in which I log all calls and meetings, out of which my “todos” and “milestones” result. So during a call, I quickly want to have the opportuniy to create “todos” and “milestones”, which should automatically appear in the two dataview-queries at the begining of that obsidian-project-note

To create my “todos” and “milestones” I use tasks, like this:
Strg+return => Checkbox, and after the Checkbox I write a short note to the topic of the “todo” or the “milestone”.
The difference between a “todo” and a “milestone” is in my convention:

  • milestones have 2 fields, [from:: ] and [to:: ], and the hashtag #ms
  • todos have just 1 field [to:: ] and no hashtag

and this is the code I use:

for the Milestones:

TABLE WITHOUT ID
	Tasks.from AS "from   ", 
	Tasks.to AS "to              ", 
	regexreplace(Tasks.text, "\[.*$", "") AS Milestone, 
	Tasks.link AS "date milestone created"
FROM #ms 
WHERE file.tasks FLATTEN file.tasks AS Tasks 
WHERE !Tasks.completed 
WHERE file.name = this.file.name
SORT Tasks.to DESC

for the todos:

TABLE WITHOUT ID 
	Tasks.to AS "to             ",
	regexreplace(Tasks.text, "\[.*$", "") AS Todo, 
	Tasks.an AS "@       ",
	Tasks.link AS "link" 
FROM !#ms
WHERE file.tasks FLATTEN file.tasks AS Tasks
WHERE !Tasks.completed
WHERE file.name = this.file.name
SORT Tasks.due ASC

Problem:
the hashtag #ms seems to be a hashtag, which is assigned to the whole obsidian-project-note, not just only to that task. So if I once use the hashtag #ms in one note, there won’t appear any todos in my dataview-query - at least, that’s my explanation, why I don’t see any…

So my question to you is:
Is there a possibility to use explicit task-hashtags? … for example as “file.tasks.tags” in my query?

Thanks in advance and kind regards,
Silias

1 Like

Yes you are exactly right! FROM is working on the entire-note level. (Aside: FROM uses a different punctuation to represent not, FROM -#ms would give you files that do not contain that tag, but that does not help you here.)

Instead of the FROM, you could look at something like (after your FLATTEN statement):
WHERE !contains(Tasks.text, "#ms")

Thanks scholarInTraining!!! :slightly_smiling_face:
You again have been a great help! :wink:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.