Help in need! How can I self-reference within the dataview?

What I’m trying to do

I’m trying to create a template that will automatically display all links linked to this note. Once I use this template, I no longer need to manually enter the dataview query to query what links this note connects to.

Things I have tried

This is my code, but it didn’t work. Thanks for reading my problem!

from "[[" + + "]]" OR from outgoing("[[" + + "]]")
	["Note", "Location"],
	dv.pages("[[" + dv.current() + "]]")
		// Sort by YAML created field
		.sort(b => b.created, 'desc')
		.map(b => [, b.file.folder.replace(/\//g, ' ‣ ').replace(/^\d+ (.+)/, '$1')])

I’m really not Dataview fluent but maybe this could work too (:woman_shrugging: ) ?

FROM [[]] OR outgoing([[]])

(Tested the query in one of my note and it seemed to return the appropriate results)

From the Dataview documentation:

  • You can implicitly reference the current file via [[#]] or [[]], i.e. [[]] lets you query from all files linking to the current file.

OMG you just saved me so much time! This works really well and so simple! Thanks so much!

1 Like

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