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:

	Tasks.from AS "from   ", AS "to              ", 
	regexreplace(Tasks.text, "\[.*$", "") AS Milestone, AS "date milestone created"
FROM #ms 
WHERE file.tasks FLATTEN file.tasks AS Tasks 
WHERE !Tasks.completed 

for the todos:

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

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,

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.