Dataview query with single value from inline field?

I’ve been trying to figure out a (hopefully?) simple Dataview query:

My meeting notes template has an inline field ‘Attendees::’ where I list the linked names of everyone at the meeting, e.g:

Page: Meeting about
Attendees:: [[Miss Piggy]], [[Kermit Frog]], [[Cookie Monster]]

And on each person’s linked page, I want a dataview query that will show a table of all the meetings that they have attended, e.g.:

Page: Kermit
Kermit Frog’s meetings:

File Date Description
[[Meeting about cookies]] 2022-01-30 etc…

Is there a simple query “WHERE” statement that can achieve this? I’ve tried something like:

	date AS "Date",
	description AS "Description"
FROM #meeting 
WHERE contains(attendees, "Kermit Frog")

…but it works inconsistently, if at all. If I remove the name links (as in `Attendees:: Kermit Frog, Miss Piggy’) it works better, but with the brackets it is only returning some of the meeting pages that exist. Is there a proper way to write this kind of query?

I’d also imagine there is a more complex way to do this with a dataviewJS code block, but am hoping to do it with a dataview query to keep the syntax as simple and clear as possible.

Thanks in advance!

1 Like


1 - a generic query pointing to the current page

WHERE contains(attendees,

2 - specifying the link

WHERE contains(attendees, [[Kermit Frog]])
1 Like

thanks, I’ve been playing with it and find a couple things:

  1. returns nothing, but works, kind of (see #3).
  2. [[Kermit Frog]] doesn’t work, but "Kermit Frog" works, again kind of (see #3).
  3. I’m finding odd behaviour where, using the correct syntax from above, the pages are only returned if in the inline field of the meeting notes, there is some (unlinked) text before or after the linked names. For example:

Meeting notes with these inline fields are not returned:

Attendees:: [[Kermit Frog]]
Attendees:: [[Miss Piggy]], [[Kermit Frog]]
Attendees:: [[Miss Piggy]], [[Kermit Frog]], [[Cookie Monster]]

…but these meeting notes ARE returned:

Attendees:: foo [[Kermit Frog]]
Attendees:: [[Kermit Frog]] bar
Attendees:: - [[Miss Piggy]], [[Kermit Frog]]
Attendees:: &nbsp [[Kermit Frog]], etc....

Something buggy with the parsing here maybe?

Well, first problem is related with the way you write the values in the field, because in some cases you have an array of links, in other cases you have a string.

Attendees:: [[Miss Piggy]], [[Kermit Frog]]

In this case you have an array of links. So WHERE contains(attendees, ask if in the array there’s the link of the current file.

In cases as

Attendees:: foo [[Kermit Frog]], [[Cookie Monster]]

you have a single value - a string - with links inside. but the type of values is a string. So, for that case you need to search in the string, not the link. For that cases it works

WHERE contains(attendees, "Kermit Frog")


WHERE contains(attendees, "[[Kermit Frog]]")


WHERE contains(attendees,

(all solutions to search “substrings” inside the global string value)

First decision need to be related with the consistency of the type of values. If not things are more complicated.

1 Like

Ahhh ok this makes perfect sense. There were some entries (names) without their own pages, thus not links, and that’s why it was inconsistent. Removing those, the argument works perfectly.

Thanks @mnvwvnm for your help and clear explanation! :+1: