Dataview plugin snippet showcase

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

4 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">
7 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")
2 Likes

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.

2 Likes

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

But how do you include that in the query to produce a second column?

I added it next to the first column after a comma
image

and it does not come up with any results

I believe you’re looking for rows which you need when you use GROUP BY.

From the docs: https://blacksmithgu.github.io/obsidian-dataview/docs/query/queries#group-by

This explanation helped me: Dataview plugin snippet showcase - #93 by SkepticMystic

So you could try:

TABLE Type, rows.file.etags
FROM ""
WHERE Type
GROUP BY Type
1 Like