Get values from files linked in key:: value array

What I’m trying to do

Hey guys, I have my vault with a note for each professor with their details.
Each Person note has title, email, phone, office_hours, etc.
Some info is in the YAML frontmatter, and the office_hours is defined as:

office_hours:: Home - Monday 11:00-12:00
office_hours:: Home - Wednesday 11:00-12:00

Then I have a course note where I list every professor associated like so:

Professors:: [[Professor Snape]]
Professors:: [[Professor Dumbledore]]

Later in the course note I’d like to show a table with some info from this course’s professors
More precisely, name, email and office hours

I have this dataview query

TABLE WITHOUT ID
	link(file.link, title) AS "Name",
	email AS "E-Mail",
	office_hours AS "Hours"
FROM #People

But this shows every #People note when I’d like to have only the notes linked in the Professors field

Things I have tried

I’ve tried adding in a WHERE clause with

  • WHERE contains(file.title, Professors) → Every note appears
  • WHERE any(contains(file.title, Professors)) → Every note appears
  • WHERE contains(file.title, this.Professors) → No note appears
  • WHERE any(contains(file.title, this.Professors)) → No note appears
  • Same combinations with title instead of file.title

I even used

TABLE WITHOUT ID
	link(file.link, title) AS "Name",
	title,
	email AS "E-Mail",
	office_hours AS "Hours",
	this.Professors
FROM #People

And remove two from the 3 professors.

I can see that only one row from the table has title = this.Professors, but can’t filter the results…

So apparently I should have asked earlier

Found the solution

Although title was in this.Professors, title was Professor Snape while this.Professors was [[Professor Snape]]

Solution

TABLE WITHOUT ID
	link(file.link, title) AS "Name",
	email AS "E-Mail",
	office_hours AS "Hours"
FROM #People
WHERE
	any(contains(file.link, this.Professors))

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