Dataview plugin snippet showcase

Wow - it works - this is all so powerful. Thank you!

To count the number of rows you could do something like this:

```dataview
LIST "There are " + length(rows.file.name) + " open issues."
WHERE issueStatus = "open" AND !contains(file.folder, "Templates")
GROUP BY issueStatus
```

22 Open Issues

3 Likes

@FiekeB and I were talking about how a recipe data collection could be set upā€”a great example for Dataview and DataviewJS, too.

1 Like

Ah that is a typo on this forum. Iā€™m from the Netherlands so datum is dutch for date. I translate it here on the forum and forgot that one.

The sort by date just doesnā€™t sort by date for me and I wonder if anyone else has that, or the solution. :slight_smile:

Have you tried enclosing datum in date()? It might not be sorting since itā€™s a link and not a date.

2 Likes

Thanks, that seemed to work perfectly!

I cannot get it to reveal the image. I manage only to show a hoverable file link, when I remove !. Any idea on what might be wrong?

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

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!