desk7
September 3, 2023, 4:05pm
1
What I’m trying to do
List all notes from a folder which have the tags of the current note.
Things I have tried
let subjects= dv.current().file.etags;
dv.table(["Ex.", "Subjects"], dv.pages('"folder"')
.sort(es => es.file.link, 'asc')
.map(es => [es.file.link, es.file.etags])
.where(es => subjects.every(elem => es.file.etags.includes(elem) )))
But I receive the following error: Evaluation Error: TypeError: Cannot read properties of undefined (reading 'etags')
holroy
September 3, 2023, 4:44pm
2
After your map()
the chain doesn’t have the full page element anymore, just the elements you’ve mapped (aka the link and the tags themselves), and they’re now in an array and not an object.
So either you need to refer to the mapped data using something like:
.where(es => subjects.every(elem => es[1].includes(elem) )))
Or maybe simpler just swap the map()
and the where()
lines around.
2 Likes
system
Closed
September 10, 2023, 4:44pm
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.