Dataview : table with metadata occurence


I use the metada to put some information by category.
Exemple I have files with this metadata

#file 1
fonctions: f1, f2

#file 2
fonctions: f1, f3

#file 3
fonctions: f2, f3

What I’m trying to do

I would like to create a table (with Dataview) which will show all the occurrence of each “fonctions” and put to the next column all the file linked

fonction Nbre occurrence Note
f1 2 file 1, file 2
f2 2 file 1, file 3
f3 2 file 2, file3

Things I have tried

	length(rows) as "Nbre occurrence"
	, join(, ", ") as "Note"

where fonctions

group by join(fonctions, ", ") as "fonction"

The result table show something like this :

fonction Nbre occurrence Note
f1,f2 1 file 1
f1, f3 1 file 2
f2, f3 1 file3

It looks like Dataview does not read string between comma separatly.

Any help would be appreciated !

The query below works in a local diagnostic, but the YAML in each file also needs to be edited as in this example:

fonctions: [f1, f2]

dataview query

	length(rows) as "Instances",
	join(, ", ") as "Notes"
	join(fonctions, ", ") as "Fonction"

Hope this helps.


Man, this is gold !

Thanks a lot for having taken of your time to help me.
Just tried it and works like a charm.
I will now add brackets to my YAML :

category: [text1, text2, etc…]

instead of

category: text1, text2, etc…

1 Like

Good to hear it works for you.

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