Dataview WHERE with linked [[... ]] Metadata

Let me first start by saying I am relatively new to Obsidian so may be missunderstanding how I am structuring my data.

What I’m trying to do

I am tryign to create a Dataview and am really struggling with the WHERE statement in relation to what I am trying to retrieve. I am trying to use the WHERE statement on a list property called genre. However I have populated the genre values as links i.e. [[Rock]] as I have them appearing in an infobox where I want them to be clickable.

I suspect it is the fact that I am storing them as a link that is causing the issue.

Things I have tried

I have tried the following:

Table total_artists as artists, genre
FROM "Music/Artist"
Where genre = "NWOBHM"

I have also tried the WHERE statement as

Where contains(genre, “NWOBHM”)

Where contains(genre, “[[NWOBHM]]”)

I can get the statement to work on properties that do not have a [] link which leads me to think this is the issue. If this is the case how else could I show a property list value in an infobox as a link?

I hope this makes sense.

Table total_artists as artists, genre
FROM “Music/Artist”
WHERE genre = [[NWOBHM]]

Should probably work.

Thanks for the response but no, this doesn’t work either. FYI there is no error but it returnes no results, which is also the case for the examples I have tried previously.

Can you upload the source code of a note and the result you get?

Sure…

First of all, this is the properties from an “Artist” note.

This is the dataview query…

And here is the result…

TABLE
artist,
genre[0]
FROM "Music/Artist"
WHERE contains(genre, [[NWOBHM]])

You can change genre[0] also to genre, depending on which style you prefer. Also make sure that the folder path "Music/Artist" is in order where your dataview query is located.

Fantastic! This worked. I was sure I had tried that previously but must have included quotation marks as well I guess.

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