Gather all occurence of tags inside a folder, in Task style

I use a lot Dataview “Tasks” to follow my actions with tags and I look for a solution to do the same with simple tags in lists.

To be more explicit I add in my daily notes task with tags, and gather them in globals notes to follow my todo, the questions to my boss, etc like this

  • #todo/this_week buy coffe
  • #AskBoss about a raise

and in my “following TOC note”

where !completed AND (contains(tags, "#AskBoss")

It works perfectly with the Task Query and i would like to implemente the same principle with lists this way

  • #buy_in_2024 a new computer

So basically a “Table” query that return One line per line mentionning a tag, instead of one line per file mentioning the tag

I tried several things like

TABLE buy_in_2024 as Expense
FROM #Buy_in_2024
sort file.ctime desc

But it does not get the text after the tag…
At the end of a day I just want to show all list items under a specific tag, accross several files.

To achieve that you need to split up the file.lists into its separate items. To do this on the entire vault could be somewhat expensive, so in the following query I do a combination of FROM #tag and WHERE contains(item.tags, "tag") to limit on a given tag to try to reduce the overall load of the query.

TABLE item.text as Expense
FROM #Buy_in_2024
FLATTEN file.lists as item
WHERE contains(item.tags, "buy_in_2024")

Try that, and see if we’re getting nearer to your wanted output. :smiley:

Amazing ! it is exactly what I wanted, thank you so much !!!