Skip to content

Instantly share code, notes, and snippets.

@m-nelly
Last active April 12, 2025 23:37
Show Gist options
  • Save m-nelly/5a3971831bacecde6d2da5a2ba0d7fe3 to your computer and use it in GitHub Desktop.
Save m-nelly/5a3971831bacecde6d2da5a2ba0d7fe3 to your computer and use it in GitHub Desktop.
Useful Dataview Queries

Today's Notes

LIST length(rows) 
WHERE created = this.created
GROUP BY split(file.folder, "/")[0] as "Folder"

LIST title
FROM -"Daily"
WHERE created = this.created
SORT file.folder

Yesterday's Notes

LIST title
FROM -"Daily"
WHERE created = this.created - dur(1day)
SORT file.folder

Overview

Notes Per Folder

table length(rows) as "Note Count"
group by split(file.folder, "/")[0] as "Folder"

Links Without Notes

TABLE length(rows) AS "Reference Count"
FROM "Fleeting"
FLATTEN file.outlinks AS outlinks
WHERE !outlinks.file AND !contains(meta(outlinks).path, "/")
GROUP BY outlinks AS "Referenced Link"
SORT length(rows) DESC
LIMIT 5

Recent Notes

Recent Fleeting Notes

table created AS "Created"
from "Fleeting"
sort created desc
limit 5

Recent Permanent Notes

table created as "Created"
from "Permanent"
sort created desc
limit 5

Stale Notes

Notes Waiting for Processing

table created as "Created"
from "Fleeting"
sort file.mday desc
limit 10

Fleeting Notes Older Than 30 Days

table created as "Created", length(file.outlinks) as "Links"
from "Fleeting"
where date(created) < (date(today) - dur(30days))
sort created asc

Missing Connections

Literature Notes Missing Links

table created as "Created"
from "Literature"
where length(file.outlinks) = 0
sort created desc
limit 10 

Permanent Notes Needing More Connections

table length(file.outlinks) as "Links", file.mday as "Last Edited"
from "Permanent"
where length(file.outlinks) < 2
sort length(file.outlinks) asc
limit 10

Unlinked Fleeting Notes (Orphans)

table file.mday as "Last Edited"
from "Fleeting"
where length(file.outlinks) = 0
sort file.mday desc

Connection Hotspots

Most Linked Files

TABLE length(rows) AS "Inbound Links"
FROM "Fleeting" OR "Literature" OR "Permanent"
FLATTEN file.outlinks AS inbound
GROUP BY inbound AS "Note"
SORT length(rows) DESC
LIMIT 10

Files With High Link Density

TABLE length(file.outlinks) AS "Outbound Links"
FROM "Permanent" | "Fleeting" 
SORT length(file.outlinks) DESC
LIMIT 10

Most Used Tags

TABLE length(rows) AS "Note Count"
FROM "Fleeting" OR "Literature" OR "Permanent"
FLATTEN file.tags AS tag
GROUP BY tag
SORT length(rows) DESC
LIMIT 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment