Dataview plugin snippet showcase

Has this changed since the time you posted this answer? I have multiple notes with ![[embedded#^content]] that I would like to query and render on dataview. Right now, I only get the syntax on the tables, but the embeds do not display.

Does anyone know how to query for a table that only lists the values a custom YAML field?

ie: I created a custom YAML field called “Type”. I start assigning “Type 1”, “Type2” etc to these fields and I want to keep track of different Types created.

The challenge is: I don’t need to see the file names + I don’t want to see multiple (duplicate) lines of the same Value assigned to different notes (maybe there are 100 notes that is “Type1” but I don’t need to see 100 lines in the table). I just want to see a short list of the Types that I create.

Any ideas?

I’m using external images… not obsidian assets, maybe that’s the problem.

Otherwise, here is what it looks like for me:

My book index (non-capital letters in my latest version):

TABLE subtitle, ("![coverimg|100](" + cover + ")") as cover, creator, referrer, priority, purpose, status from "Books"
where file.name != "_Book Index"
SORT file.name

Here is my book page:

# AntiFragile

cover:: https://images-na.ssl-images-amazon.com/images/I/41wd4dlgGBL._SX322_BO1,204,203,200_.jpg
creator:: Nassim Taleb
priority:: Medium
purpose:: Execution, Strategy
referrer:: CEO Summit (june 2016)
status:: To Read
subtitle:: Things That Gain from Disorder

3 Likes

Try this,

TABLE Type
FROM "" 
WHERE Type
GROUP BY Type
2 Likes

I can confirm this is an issue. I use the same for my movies database and external links work like these but internal one’s don’t.

1 Like

For images I use a field with link to local files:

preview: <img width="150px" src="file:///Users/..../image.jpg">
4 Likes

Oi oi oi! That’s indeed quite clever. It doesn’t look very nice though! And I’d be vary of hard-coding the image size.

I’ve been trying to get ![[link to image]] work and now I’m wondering if that could work with your method as well. But I’ve tried to avoid adding links like that in YAML because of issues it has with the syntax. Thanks for sharing this though. I was following your github issue regarding this as well. This is a good workaround.

1 Like

Yes, you’re right. This doesn’t look good and it’s not very ‘practical’.
But for now it’s the only way I found to use local sources.
About YAML and syntax, hmmm… I’m a newbie in all this things! I just understand the basic of html, css and no more :slight_smile:

Here is a discussion with an example where it fails. The thing is [] is an array in YAML which messes up when mixed with Wikilinks.

1 Like

Hi! Im trying to have a daview table in my meeting note with the last 3 meetings from the date of the meeting I’m taking notes…can anybody help me please…Thanks in advance

This works Rishi thank you :slight_smile:
Can you also advise how I can also add “Tags” as a second column to the table?
The “Where” and “Group by” commands don’t seem to like multiple variables :man_shrugging:

Try rows.tags. When we use GROUP BY, we get the attributes in the rows object.

1 Like

@mnvwvnm I’d be grateful for a little help with something similar. I’m trying to use Dataview for the first time to create an aggregated list MOC within my daily notes that renders all notes created on that day only.

I have YAML with the following in various notes:

---
created: 2021-06-24
---

And have tried the following in my Daily Note but am getting an error:

```dataview 
LIST
FROM "" 
WHERE  created = “2021-06-24”
```Dataview: Error: 
-- PARSING FAILED --------------------------------------------------

  1 | LIST
  2 | FROM "" 
> 3 | WHERE  created = “2021-06-24”
    |                   ^
  4 | 

Expected one of the following: 

'(', 'null', boolean, date, duration, file link, negated field, number, string, variable

I’m not sure what I’m doing wrong – appreciate any advice & thoughts!

I’m not an expert in Dataview (far from that, a very, very newbie)…
My first observation is: why you create a field (“created”) if this data is an “Implicit Field”?
I.e., as you can read in the plugin documentation, there’re some metadata implicit to each file: name, size, created date, last modified date, etc.
In your case, if you are interested in the day that you create the notes, then you just need to query the file.cday implicit metadata and forget the frontmatter entry.
Try this:

```dataview
LIST
FROM ""
WHERE file.cday = date("2021-06-24")

If you want to define your own field for created date, then you need to have some attention with the way that the plugin reads the format for date. In that case, I think you need to do this:

```dataview
LIST
FROM ""
WHERE created = date("2021-06-24")
1 Like

can you elaborate more on the exact syntax - how to include it in dataview query?

You can try this,


TABLE Type, rows.tags
FROM "" 
WHERE Type
GROUP BY Type

The docs explain how this works better than I can.

Yeah, I couldn’t get internal links to work… good thing I don’t use them on that :stuck_out_tongue:

Some of you may find this useful. It’s a dataviewjs script for creating a markdown table from a dataview table.

1 Like

In case you’re still looking for this answer, the implicit field files.etags should do the trick.

1 Like

Minor example

Posting here more to say a heartfelt thank you to @blacksmithgu for creating this

If there was only a choice to use 1 plugin it would be this one for me. It’s totally transformed the way I work with Obsidian

table title, system, state, created, file.mtime, update
FROM ""
WHERE year=2021 AND node="branch" AND type = "stats"
SORT status asc, system asc, title asc, year asc, month asc
2 Likes