Useful Dataview Snippets 🧮

These are some super useful data view snippets I use in my Obsidian note.


Index of All Notes ( Listed as Table )

TABLE link(sort(rows.file.name)) AS Files 
FROM "" WHERE file.folder 
FLATTEN file.folder AS Folder 
GROUP BY Folder
SORT Folder Asc 

Index of All Tags ( Listed as Table )

TABLE WITHOUT ID (tag + "(" + length(rows.file.link) + ")") 
AS Tags, link(sort(rows.file.name)) 
AS Files 
FROM "" 
WHERE file.tags 
FLATTEN file.tags 
AS tag 
GROUP BY tag 
SORT file.name Asc 

List All Recently Modified Files

LIST FROM "" 
WHERE file.name != this.file.name
SORT file.mtime DESC LIMIT 15

I also use a plugin call Zoottelkeeper which creates an auto-updating index file inside all the folders.

In the “Zoottelkeeper plugin settings” I have prefixed all index files with ":label: ".

So, I have added an additional line to omit the auto-updated index files from showing up in the recent file.

WHERE !contains(file.name, "🏷")


edit: added date also

LIST 
" | <small>*Modified: "+file.mtime+"*</small> 
| <small>Created: "+file.ctime+"</small>"  
FROM ""
WHERE file.name != this.file.name
WHERE !contains(file.name, "🏷")
SORT file.mtime DESC LIMIT 15

preview


24 Likes

This are the most useful Dataview Snippets examples I’ve come across. Even better to understand than the ones given on the documentation/page of the plugin.

Thank you for sharing them since they helped me understand a little bit better about how to group.

1 Like

Very helpful. Thank you!

How do you get the different colors? I tried with adding <p style="color:blue">...</p>, but that destroyed the list format.

1 Like

I use @nickmilo 's “Cybertron Theme”, with my custom CSS snippet.

.markdown-source-view .cm-s-obsidian {
    font-family: 'MonoLisa', monospace !important;
}

.markdown-preview-view {
  font-family: 'Rubik', sans-serif !important;
}

.theme-dark
{
  /* only for cybertron theme */
  --background-primary: #161b22;
  --text-normal: #dedede;
  /*
  Cybetron Original Colors
  --background-primary: #2f3136;
  --background-primary-alt: #36393f;
  --background-secondary: #141414;
  --background-secondary-alt: #222222;
  */

}

.table-view-table tr {
    border-bottom: 1px solid;
}
1 Like

May I ask what theme you’re using? I’m obsessed with the colors.

“Cybertron Theme”, with my custom CSS snippet. ( Given ina post above )

1 Like