Dataviewjs Help

What I am trying to do

At the top of my note I have the links to the parent note like this
Parent::[[Some Note]]

I want to display the incoming links the note excluding the notes in the parent field

What I tried

dv.list(dv.current().file.inlinks.filter(f => f!=dv.current().file.Parent)) 

But the the parent field notes are not exclude. So I tried this to debug

dv.span(dv.current().file.Parent)

expecting an output [[Some Note]] but instead got a blank list

Hi, again.
As I said before, I can try some steps in js but definitely that isn’t my ground, i.e., I don’t have code knowledge.
I can look to your attempts and say some things:

  • if we want to target a created field (not an implicit field) we don’t need to add the prefix file: not dv.current().file.Parent but dv.current().Parent
  • if values are “links” we need to work in different way (links aren’t “strings”)

With all my obvious limitations, I can suggest this:

dv.list(dv.current().file.inlinks.filter(f => !f.path.includes(dv.current().Parent.path)))

But this seems to work only if you have only one value in Parent::… if more than one link this doesn’t work.
As you can see my effort stops in simple things like «how to solve this if a list/array»?

1 Like

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