How to manage a multi-author book using dataview

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

I am currently using obsidian’s dataview to manage my books.
In normal use, I set up an “author” field, registered the author’s name there, and wrote the dataview as follows.

dataview
	table WITHOUT ID
	title as "title", year as "year", author as "author"
	from #Book and #written 
	where author = [[Barack Obama]]
	sort Year asc

This method is fine for a single author, but when there are multiple authors, there was a problem that the information of multiple authors could not be registered.
Therefore, I would like to set “author” to “list” and display the “author” field as it is in the output list.
I am trying to do this, but I am not sure how to do it.
Does anyone know how to do this?

I saw this (Dataview query author's work where there are multiple authors in frontmatter of a work cosmos), but I would like to put the name on the table as a link if possible.

Given either of the following markup used for authors:

author: "[[Barack Obama]]"
... or ...
author:
- "[[Barack Obama]]"
- "[[Donald Trump]]"

You should be able to query either of them using a trick like:

WHERE contains(flat(list(author)), [[Barack Obama]])

This trickery using flat(list(...)) ensures that whatever notation is used for the field, we can use the list comparison functions to check against it.

1 Like

The solution worked out as ideal! Thank you very much!

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