I am trying to the automatically put the file title (writer’s name) into a dataview query. If I type in “Aaron Jones” between the brackets, it works fine. I have almost 200 files to edit, so I thought I could automate it.
In a standard DQL query like your example, the this.file.name should work to get the actual name of the file. If you want the writer field from the current file, you should use this.writer. So a little depending on whether you actually want the file name or a link, your query looks differently:
Just the name
```dataview
TABLE
FROM "Books"
WHERE writer = this.file.name
SORT file.name ASC
```
This would require that each book has a single property of the form: writer: Aaron James.
Links
In the case of links, it would look like:
```dataview
TABLE
FROM "Books"
WHERE writer = link(this.file.name)
SORT file.name ASC
```
Which would require that each books a single property like in: writer: "[[Aaron James]]"
What about multiple authors?
And this is where it gets tricky if your books have one or more writers. Since that require some trickery to force every entry into being a list and checking against that list. Given a list of names (not links) the query would then look like:
```dataview
TABLE
FROM "Books"
WHERE econtains(flat(list(writer)), this.file.name)
SORT file.name ASC
```
With the variation of link(this.file.name) (instead of this.file.name) if writer in the books is written as a list of the form:
Thank you for the thorough explanation. I used the example you showed for links and this works fine. I apologize to @woofy31 - in my books files, the value for writer is formatted as a link. I did not realize this when I posted this topic.
Now I can use Linter to add this dataview query to the 150 or so writer files.
Again my thanks to both of you for your suggestions.