Auto inserting new note title into a dataview query

Hi there. I’m really enjoying Obsidian and especially since I started using the Dataview plugin as it’s made a big difference to my workflow.

I’ve got a project that I’m using as a test project to familiarise myself with Obsidian and dataview. I have a list of a few different TV Shows that I know share some of the same cast members. I have a property box called ‘Cast’ that is a list in each note created for an episode title.

When I create a note for a cast member, I use a template with the following query to create a table displaying which shows they are in, sorted by date.

TABLE Season-Episode, Broadcast
FROM "10 TV Shows"
WHERE contains(Cast, [[John Doe]])
SORT Broadcast ASC

What I’m trying to do

What I would like to have is the query fill in the new note title, ‘John Doe’ (in this line “WHERE contains(Cast, [[John Doe]])” automatically so that I don’t have to edit the query each time I add a note.

I have no idea if this is possible but I thought I would ask.

Thank you.

use this.file.name instead of [[John Doe]].
Though if it’s a list of links instead of strings you’ll need to compare this.file.path to the path of the link

Hi cheezopath

Thank you. Yes my list includes links but the line it does work if as I wanted I change the entry to a string.
:+1:

1 Like

After a bit more digging I found that this gave me exactly what I wanted: this.file.link

1 Like