I’m trying to build a list of notes grouped by the values of either a sub-tag or YAML value. Either route is fine if one is possible and the other is not.
I have front matter like this:
---
technology:
- Go
- PHP
---
And tags like:
#technology/Go
#technology/PHP
#technology/NodeJS
And I am looking to make a table like this:
Go
| Name |
Creation Date |
| File with Go tag 1 |
June 1, 2021 |
| File with Go tag 2 |
May 26, 2021 |
PHP
| Name |
Creation Date |
| File with PHP tag 1 |
June 1, 2021 |
| File with PHP tag 2 |
May 26, 2021 |
This dataviewjs gets me close:
for (let group of dv.pages("#product").groupBy(p => p.product)) {
dv.header(3, group.key);
dv.table(["Name"],
group.rows
.sort(k => k.rating, 'desc')
.map(k => [k.file.link]))
}
But I have two problems
- In my example, I’m using a mix of tags (find pages with
#product) and frontmatter (group by product). I’d rather use either tags or frontmatter.
- Several of my notes have multiple
product values. If my product array is [“Pencil”, “Pen”] I’ll get a grouping of “Pencil, Pen” not a section called “Pencil” and another called “Pen”

Any suggestions for modifying my query?