Why is my dataview table not pulling all possible notes?

What I’m trying to do

I’ve just started with dataview. I made a table that should pull books with “Book” in the YAML field “Type”, but the table only pulls 3 of the 8 notes is should pull … I will have many more book notes in the vault if I can make this work :). This is my table code:

TABLE  People, Status, Detail
WHERE Type = "Book" 

Things I have tried

I have checked the notes that are not appearing to be sure they have “Book” in that field.
I have searched help and forums to see if the pull is being limited to 3 notes as a default and I need to add a “limit” parameter of “all” or something.

A few unrelated questions:

  1. If I put a link in a YAML field, it appears in the table not as a link style, but indented with a bullet which looks weird. Is there a spec I could add that would change this? If not, I guess I will not use links in the metadata, at least for author.

  2. Is there an easy way to reduce the size of the table content so that more columns will fit?

Thank you!!

One way to make your query fail to load all notes in local tests is to have an inconsistent spelling of the key: Type and type.

Always spelt in the YAML with a capital T?

Yeah, the YAML block was cut and pasted into all of the notes.

Hi atwood, thanks for your note.

Could you post an example of one of the files that isn’t appearing in your table, but you expect it to? That would help us troubleshoot the issue.

Sure, Yes!

Here’s the top half of one:

---
Date_Note:: 2022-04-06
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: [[History]] [[Philosophy]] [[American History]] [[@ Dad]] [[President]] 
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: [[Henry Adams]]
Organizations: 
Links: 
---

https://www.goodreads.com/book/show/82896.The_Education_of_Henry_Adams?ref=nav_sb_ss_1_24
[Pulitzer Prize for Biography or Autobiography (1919)](https://www.goodreads.com/award/show/16-pulitzer-prize)

"The world after 1865 became a banker's world."
Chap 17, 27:18

And here is a screenshot of the table and the table code (ignore the bizarre book selection, it’s just random as I sort out this system).

I have been keeping info on things like books in databases in Notion. I’m trying to see if I could move this data to Obsidian. The Notion tables present more cleanly, with the ability to narrow columns and scroll left to right.

Your inline fields need double colons! ::

I edited your post to put triple backticks ``` around your Markdown, so we can read it.

Is the part you posted in your YAML section, or in the main body of the note?

(By the way, when posting from your vault, it’s a good idea to start and end the block with four backticks (````). That will help make sure the forum doesn’t mangle the formatting.)

1 Like

OK, I can see more clearly now. Thanks for posting an example.

Your YAML block has some issues. YAML frontmatter fields are formatted differently than Dataview inline fields.

First, YAML fields should only have one colon. Your “Date_Note” field has two.

Second, links should be enclosed in quotes, e.g. "[[Henry Adams]]" rather than [[Henry Adams]]. This is because brackets have special meaning in YAML, used to define lists.

Third, your Detail field should either be surrounded by quote marks or else have commas between each item, e.g. either:

"[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]"

or

"[[History]] [[Philosophy]] [[American History]] [[@ Dad]] [[President]]"

You can get an idea of what Dataview can see in your file by using a simple query like this:

```dataview
LIST this.file.frontmatter
WHERE file.path = this.file.path
```

I made some corrections to your YAML so it now looks like this:

---
Date_Note: 2022-04-06
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: "[[History]] [[Philosophy]] [[American History]] [[@ Dad]] [[President]]"
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: "[[Henry Adams]]"
Organizations: 
Links: 
---

And this is what Dataview can see:

image

I hope this is helpful!

2 Likes

Can I ask… using Detail: "[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]" reads as invalid YAML. The values do work if arranged as a sequence. Or am I doing something wrong?

---
Date_Note: 2022-04-06
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: "[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]"
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: "[[Henry Adams]]"
Organizations: 
Links: 
---

Oh, whoops! My mistake.

If you’d like them to be interpreted as a list you must also enclose them in brackets or format them as a bullet list:

In brackets:

Date_Note: 2022-04-06
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: ["[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]"]
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: "[[Henry Adams]]"
Organizations: 
Links: 

As list:

Date_Note: 2022-04-06
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: 
- "[[History]]"
- "[[Philosophy]]"
- "[[American History]]"
- "[[@ Dad]]"
- "[[President]]"
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: "[[Henry Adams]]"
Organizations: 
Links: 

Either way:

1 Like

Many thanks for the clarification. Helps me a lot. :pray:

1 Like

Thank you so much for your attention with this. Putting quotes around the bracket links cleared up the problem with how that content displayed in the table. I revised that situation across all the books and removed the second colon in the Date_Note field. This made one more book appear in the table, but still not the other few. For instance this:


---

Date_Note: 2022-07-06

Date_Subject: 2020-10-06

Date_Completed:

Type: Book

Detail: "[[SciFi]]", "[[Climate Change]]"

Status: Read

Tags:

Summary:

Location:

Rank: 23

Excitement: 5

Group:

Attendees:

People: "[[@ Kim Stanley Robinson]]"

Organizations: "[[Hachette]]"

Links:

---

and this:

---
Date_Subject: 1918-01-01
Date_Completed: 
Type: Book
Detail: "[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]" 
Status: Reading
Tags: 
Summary: 
Location: 
Rank: 20
Excitement: 4
Group: 
Attendees: 
People: "[[Henry Adams]]"
Organizations: 
Links: 
---

(I hope I put in the 4 back ticks correctly).

1 Like

This is the YAML for the book that did appear in the table after I made the edits:

---
Date_Note: 2022-05-17
Date_Subject: 2019-09-24
Date_Completed: 
Type: Book
Detail: 
Status: Read
Tags: 
Summary: 
Location: 
Rank: 
Excitement: 
Group: 
Attendees: 
People: "[[@ Haruki Mirukami]]"
Organizations: 
Links: 
---

Note, the first example I just posted is spaced out because I copied and pasted it from a code editor.

So, if you try either of those and switch to reading view, you’ll get Invalid YAML, and you need to figure out why.

It seems like it’s the Detail: field, which you’ll need to surround with [ ... ] like @Craig said in a previous post, so that it reads:

Detail: [ "[[History]]", "[[Philosophy]]", "[[American History]]", "[[@ Dad]]", "[[President]]" ] 

One way to verify/locate your faulty YAML is to copy --- into your clipboard, and then try ending the frontmatter at various places to see where it doesn’t accept your markup.

So try adding the --- first in the middle of your frontmatter list, if it’s OK when switching to reading view, then move it further down. If it’s still invalid, then move it up. With a few insertions like that you’ll locate the offending line(s), and can start working with correcting it.

1 Like

Ah, I misread those directions; I thought brackets around all the multiple links was an option if you want the items to appear in a list as opposed to separated by commas. Adding the brackets did indeed fix the YAML. I guess the list format is necessary. And thank you for the tip of switching to reading mode to check the YAML syntax.

I truly appreciate all of your help with this. I finally have a successful handhold on dataview!

1 Like

Another way is to use the option to move the --- line up and down using hotkeys, and having the same note loaded in one side-by-side pane in source mode, and in the other pane in read mode. Helps to see immediately if the YAML is invalid at a certain line.

Don’t know if there are default hotkeys for this, but I use:

  • Move line up: OPT CMD ↑
  • Move line down: OPT CMD ↓
1 Like

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