Things I have tried
What I’m trying to do
I am trying to search my photos for any photos that contain a particular person. For example, I would like to see a table showing all the photos that have my friend “Julia” in it.
This is how the photo files are set up:
Type: “Photo”
Date: “[[02-06-2022]]”
Tags: test
People: [“Julia”, “Bob”]
Image:: ![[download.jpg]]
This is the code I am using to try and retrieve this photo that contains “Julia”:
let searchterm = dv.current().searchterm;
let pages = dv.pages(searchterm).where(p => p.Type == "Photo" && p.People.includes("Julia"));
// Create table
dv.table(["Photo", "Location", "Date",],pages.map(p => [`<img class="myTableImg" src="${this.app.vault.adapter.basePath}/Assets/${p.Image.path}">`,p.file.link, p.Date]));
However, I get this error:
Evaluation Error: TypeError: Cannot read properties of null (reading ‘includes’)
I have to use dataviewjs as I can not see the photos if I only use dataview (if there is a way to use dataview and see photos please let me know!)
I am pretty new to JS so a lot of this is going over my head, any help would be appreciated
Many Thanks.
Summary
This text will be hidden