Making lists with Dataview of all values in use in metadata field

I have been going through and annotating all my notes and creating different views with Dataview. This is all going very well. A big part of this is or course coming up with metadata. I have now assigned a ton of these, such as giving each note a note type, and devising other fields to further specify properties of that type, like location, people involved, etc.

It occurred to me that it would be handy to be able to generate lists of all the values currently in use for a given field, like being able to list all locations I have put in the locations field, or all people mentioned throughout all notes. Essentially like running some kind of uniq on the list of values that have been used in a given field. I may just be using the wrong plugin for the job, but the documentation is pretty dense; I’m not sure if it is not there, or if I just can’t find it.

Things I have tried

Unfortunately not much. I have come close by making a table containing the field and then sorting by value, but that lists every single file that has the field, not just a list of the values. I have been over and over the Dataview documentation, and can’t see anything that seems like it could possibly be used to generate lists like this. Whenever I search, the results don’t seem even close to what I’m trying to do.

What I’m trying to do

List all values of a metadata field that currently exist in a set of files.

For example, if I had the following notes with a location field with these assigned values:

note1: location: [ Los Angeles , California ]
note2: location: [ Paris , France ]
note3: location: [ Paris , France ]

I could get the following lists by city, state/country or both:

  • Los Angeles
  • Paris


  • Los Angeles
  • Paris
  • France
  • California

Or better still:

  • Los Angeles, California
  • Paris, France

Can this be done in Dataview? If not, any suggestions on how I could do this?

Thank you!


I think typing up the question helped me figure out the answer.

This can do it as a table:

  source_type AS "Type"
FROM "Source Notes"
GROUP BY source_type

This gets the YAML list into a string:

  join(location) AS "Location"
GROUP BY location

However, I still can’t figure out if it is possible to get the results as a list.

1 Like

This worked for me:

GROUP BY join(location, ", ")
1 Like

That works. Thank you!

I did add a line to remove the line that was taken up by empty location fields, but it did the trick!

	WHERE location
	GROUP BY join(location, ", ")
1 Like

Very good call, I frequently forget to filter out empty or missing fields. Well done!

1 Like

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