The following works locally but not clear if it is really doing what you want or is just a fudge.
---
Alias: [[Stephen King]]
Full Name: Stephen Edwin King
Years: 1947-
Photo: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Stephen_King%2C_Comicon.jpg/330px-Stephen_King%2C_Comicon.jpg
Tags: Horror
Country: US
cssClasses: cards, cards-cover, cards-2-3, table-max, max
---
# dataview
- This file in folder called `_inbox`.
- File called `It` in folder called `000`.
- Only change is to the alias above from `Stephen King` to `[[Stephen King]]`
```dataview
Table
Title, Year
FROM "000"
WHERE contains(Author, this.Alias)
```
That’s good, but unfortunately without the quotation marks in the frontmatter the link doesn’t exist (which makes the square brackets unuseful). Any other ideas? Thanks
I looked at this for a couple of hours last night and again this morning for another hour. Manual coding of values (1 and 2 below) works with the original YAML, so I assume it must be possible with keys as well.
Tried meta(link) as well, thinking that the Author key in the book page is now a link, but no luck. Blundering around in the dark
Main thoughts: I expect someone like holroy or craig or mnvwvnm would know what to do here in an instant.
Secondary thought that was Datacore is going rip things up quite radically.
Views in Datacore are editable and no longer use the Dataview Query Language.
I’ll keep stumbling and post if I strike lucky.
---
Alias: Stephen King
Full Name: Stephen Edwin King
Years: 1947-
Photo: https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Stephen_King%2C_Comicon.jpg/330px-Stephen_King%2C_Comicon.jpg
Tags: Horror
Country: US
---
# original
```dataview
Table
Title, Year
FROM "000"
WHERE contains(Author, this.Alias)
```
# 1
```dataview
Table
Title, Year
FROM "000"
WHERE Author = [[King, Stephen|Stephen King]]
```
# 2
```dataview
Table
Title, Year
FROM "000"
WHERE contains(Author, [[King, Stephen|Stephen King]])
```
And the output as shown in the Developer Tools reveals this:
With no quotes, the end result is actually an array with an array, and the inner array, has two elements separated by comma, ,, so it holds “King” and “Stephen | Stephen King” as its values.
And the second output, of the inline field, is an actual link (to a non-existing file in my case).
Show this frontmatter as a TABLE
Now I continued to add the following to my test file:
## Shown as a table
```dataview
TABLE WITHOUT ID Matches, NoQuotes, Quotes, meta(Quotes), Matches = meta(Quotes).display
FROM #f54123
WHERE file.name = this.file.name
```
And here it becomes a little hairy. The third column is showing the Quotes as a link, and that link is produced by dataview somewhere, and now we can also do the meta(Quotes) and reveal that the display is the part we want to match against.
So the last column shows us what the new match needs to be: Matches = meta(Quotes).display. In the case of having multiple authors, the syntax might vary a little depending on how you write it in the book page.
Note that all of the above assumes that all of your authors have note names like “King, Stephen”, and that you’ll always use an aliased version in the (fake) book entry (which is my test file), like [[King, Stephen|Stephen King]]. In other words, you might run into issues if you deviate from this setup.
Hopefully, this clarifies some of the issue, even though I’ve not written the actual query related to matching a book towards an author. Please let me know if there’s still something unclear about how to achieve that goal, and I’ll maybe write up some stuff later on today/this evening.
User Requirement Specification (URS):
1.The Author field, in each Book page, is either a fileLink such as “[[King, Stephen|Stephen King]]” or an array of fileLinks such as [ “[[King, Stephen|Stephen King]]”, “[[Toliken, J.R.R.|J.R.R. Tolkien]]]” ].
2.The Alias field, in each Author page, is a string such as “Stephen King”.
3.The DQL10 is in an Author page such as [[dic_19620411]], [[Stephen King]], or [[King, Stephen]].
4.The fields mentioned above, such as the Author and Alias, are correct at all times.
How to compare the Author field, whch is a fileLink such as “[[King, Stephen|Stephen King]]” with the Alias field, whch is a string such as “Stephen King”?
1.Author: (in Book pages) 1.1 a fileLink such as “[[King, Stephen|Stephen King]]” 1.2 an array of fileLinks such as [ “[[King, Stephen|Stephen King]]”, “[[Toliken, J.R.R.|J.R.R. Tolkien]]]” ]
2.Alias: (in Author pages) a string such as “Stephen King”
1.To filter by Author 2.To break up a list Author into each element OneAuthor 3.To filter by meta(OneAuthor).display 4.To display the result as a table
1.The fields such as the Author and Alias are correct at all times.
2.The DQL10 is in an Author page such as [[dic_19620411]], [[Stephen King]], or [[King, Stephen]].
title: DQL10_compare_a_fileLink_with_a_string_and_TABLE =>1.To filter by `Author` 2.To break up a list `Author` into each element `OneAuthor` 3.To filter by `meta(OneAuthor).display` 4.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
file.link AS "Book",
this.file.link AS "current Author link",
meta(OneAuthor).display AS "display",
this.Alias AS "current Author Alias",
meta(OneAuthor) AS "meta(OneAuthor)"
FROM "100_Project/02_dataview/Q25_MetaFunction/Q25_test_data/Books"
WHERE Author
FLATTEN Author AS OneAuthor
WHERE meta(OneAuthor).display = this.Alias
```
I did go through and change ALL author names to the aliased versions like you say: [[King, Stephen|Stephen King]]. (which I did before testing it lmao, otherwise I might have chosen another path)
However, beyond that I don’t understand how you get the output of the Quotes thing, as I get an error if I use your short example Query. Tomorrow or whenever you get a chance would be fine, thanks, this is not a rush!
Two questions before I’m able to tackle that query, what is the actual name of your Author notes, is it “King, Stephen” (or “Stephen King”)? And how do you list multiple authors now in a Book note?
But Dataview can interpret a value as a link, yes?
Links in YAML Frontmatter
If you reference a link in frontmatter, you need to quote it, as so: key: "[[Link]]". This is default Obsidian-supported behaviour. Unquoted links lead to invalid YAML frontmatter that cannot be parsed.
parent: "[[parentPage]]"
Please be aware that this is only a link for dataview, but not for Obsidian anymore - that means it won’t show up in the outgoing links, won’t be displayed on graph view and won’t be updated on i.e. a rename.
Note how the different books, uses slight variations of how to present the authors, with the final book not presenting an alias for the author.
The one and only Stephen King
King, Stephen
---
Alias: Stephen King
---
### Using FLATTEN and ECONTAINS on alias
```dataview
TABLE Author, Year, this.alias, meta(OneAuthor).path, meta(OneAuthor).display
FLATTEN Author as OneAuthor
WHERE file.folder = this.file.folder
WHERE econtains(meta(OneAuthor).display, this.alias)
```
### Using FILTER on alias
```dataview
TABLE Author, Year, this.alias
WHERE file.folder = this.file.folder
WHERE Author AND filter(Author, (a) => meta(a).display = this.alias)
```
### Using FLATTEN and ECONTAINS on file path
```dataview
TABLE Author, meta(OneAuthor).path
FLATTEN Author as OneAuthor
WHERE file.folder = this.file.folder
WHERE Author AND econtains(meta(OneAuthor).path, this.file.path)
```
### Using FILTER on file path
```dataview
TABLE Author, Year
WHERE file.folder = this.file.folder
WHERE Author AND filter(Author, (a) => meta(a).path = this.file.path)
```
In the previous section, I’ve included four queries, which outputs the following:
The scripts uses either a combination of FLATTEN and econtains or just a filter on the entire Author field. The two first matches against the meta( ... ).display part, aka the aliased version, and the last two matches against the actual file path to the note, aka the meta( ... ).path part.
The two last ones are the only one showing the book “No Alias King”, since that doesn’t use an aliased link as the Author. A similar case could be if you type the wrong alias, so I would recommend using the file path version, as it’s a given where the file path is, but you don’t really know which alias someone wants to use for an author. In addition, that would also allow for multiple pseudonyms (or aliases) to be used for any author.
So there you have some script alternatives, which should be adaptable to your case, and ready for use. As the files and query here are presented as something ready to run as long as you place all files in the same folder, you need to change the first WHERE clause of the scripts, to match your settings. (Or exchange it with a FROM (which needs to be before any FLATTEN lines)
FLATTEN Author as OneAuthor
WHERE Author AND econtains(meta(OneAuthor).path, this.file.path)
works! So I marked it as the solution, just another question, none of your file.folder work, though I think they’re not necessary? But what were they meant to do?