Dataview plugin snippet showcase

I actually hadn’t figured it out myself, but your question made me give it a go. I think I’ve got it…

So, I’m gonna use an example:

In each of my assignments, I have a field (intensity) with a red, yellow, or green square telling me how much work will be required.

image

So, if I want to group all of my assignments by their intensity, I do the following.

First, gather all the assignments:

FROM #Assignments

Then, group by intensity:

GROUP BY intensity

rows Object

Now, here is the part that confused me… by grouping them, you’ve now got a new object created by the grouping. This is a nested list of all the assignments grouped by intensity. So something like:

[
[A1, A2, A6], // Green
[A3, A4], // Yellow
[A5, A7] // Red
]

The way you access this new list is with the rows object.
So if I want the file name of every note in the array, I call rows.file.name.
If I want the dueDate of each note in the array, I call rows.dueDate.

In this example, I call the title property (rows.title).

Now, you sorta have to change the ordering around, but it should still make sense.

TABLE intensity, rows.title 
FROM #Assignment
GROUP BY intensity

Which gives me this, as desired:


So for your example, you want to group files by subtag. Can you try this and let me know what you get? I think the output will be a little messy, because it repeats alot of the tags, but it should still group them as you want.

TABLE rows.file.name, rows.file.tags
FROM #Note
GROUP BY file.tags

Also, it will only consider two notes to be in the same group if they have exactly the same tags. So even if two notes have #Note/Author, if the one has a tag that the other doesn’t, I don’t think they’ll be grouped together.

33 Likes