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 Frog.md
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:
TABLE
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, I’ve been playing with it and find a couple things:
this.file.link returns nothing, but this.file.name works, kind of (see #3).
[[Kermit Frog]] doesn’t work, but "Kermit Frog" works, again kind of (see #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:
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, this.file.link) ask if in the array there’s the link of the current file.
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")
or
WHERE contains(attendees, "[[Kermit Frog]]")
or
WHERE contains(attendees, this.file.name)
(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.
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 this.file.link argument works perfectly.
Thanks @mnvwvnm for your help and clear explanation!