Tricky dataviewjs query to list desperate quotes from different titles with the same Class, Author

You have a fair point there! Indeed, if lists include items with another #tag or no tags at all, the query will output those list items too. My bad! Instead of using file.lists.text we can make it work with file.lists.tags.

And yes, if we assume the list only contains quotes, filtering by #quotes it has no use. I’m keeping it in the example just to show how to filter by tags.

Here’s the example fixed, for future reference.

Sample Notes

Notes

Quotes.zip (1.5 KB)

# /Quotes/Janes Book of Fish.md

---
author: Jane Doe
class: references
---

# Quotes
- One lorem #quote 
- Two lorem #quote 
- This is an idea #idea
- This is a text without a tag

#/Quotes/Janes Doe Memoir.md
---
author: Jane Doe
class: references
---

# Quotes
- Three lorem #quote 
- Four lorem #quote 
#/Quotes/John Doe Memoir.md
---
author: John Doe
class: references
---

# Quotes
- Seven lorem #quote 
- Eight lorem #quote
#/Quotes/The Mysterious Deaths of Jane and John Doe.md
---
author: 
- Jane Doe
- John Doe
class: mistery
---

# Quotes
- Five lorem #quote 
- Six lorem #quote 
- Another item
- Amazing idea #idea

List of all the quotes

Query
```dataview
LIST
	WITHOUT ID
	L.text
FROM 
	"Quotes"
FLATTEN
	file.lists AS L
WHERE
	contains(L.tags, "quote")
```
Output

Quotes grouped by title without the #:

Query
```dataview
LIST 
	replace(rows.L.text, "#quote", "")
FROM 
	"Quotes"
FLATTEN
	file.lists AS L
WHERE
	contains(L.tags, "quote")
GROUP BY 
	file.link
Output

Quotes by class:

Query
```dataview
LIST 
	replace(rows.L.text, "#quote", "")
FROM 
	"Quotes"
FLATTEN
	file.lists AS L
WHERE
	class = "references"
AND
	contains(L.tags, "quote")
GROUP BY 
	file.link
```
Output

Quotes from mistery class and Jane Doe author:

Query
```dataview
LIST 
	replace(rows.L.text, "#quote", "")
FROM 
	"Quotes"
FLATTEN 
	author AS A
FLATTEN
	file.lists AS L
WHERE
	A = "Jane Doe"
AND
	class = "mistery"
AND
	contains(L.tags, "quote")
GROUP BY
	file.link
```
Output

@Greener this is also a good suggestion, you can just include something like this in your book notes:

# Quotes
- First quote 
- Second quote

And then use a query like this to pull ONLY the list below the # Quotes section.

```dataview
LIST
	L.text
FLATTEN 
	file.lists as L
WHERE 
	meta(L.section).subpath = "Quotes"
```