Dataview plugin snippet showcase

Has this feature been added yet? I have successfully generated a LIST of notes, which is useful, but it would be even better if I could transclude. Even more so if I could force only transclusion of their first line, or of a specific heading common to all of them.

1 Like

I came here looking for exactly the same thing.

@Gnopps I found the answer in this comment on Issue #177!! Worked a treat for me!

Hi all,

I’ve been trying to implement a ‘Dormant projects’ list/query. It should give links to files that contain no unfinished tasks with the #next tag. I’ve tried:

	LIST from #project AND -#next AND "1. Projects" AND !"4. Archive"
	sort file.mtime desc
	limit 5

But this sees a project as dormant if there exists a finished task with the #next tag. I imagine I have to do something with dataviewjs, looping through all unfinished tasks and checking them for #next but I don’t know where to start. Any pointers would be helpful.

This is probably nothing new for you, but I love what Dataview’s task functionality enables in my workflow:

Anytime I write something in a random or daily note which is important and I want to keep for later, like a task, insight, idea etc., I can simply make it a - [ ] task and tag it #insight.

Then I have a note where Dataview gathers all these important snippets from all over the vault with the task query:

TASK
WHERE contains(tags,"insights")
SORT tags asc
4 Likes

I’m trying to create a list of all created/modified notes on a specific day in my daily note for that day but with the following code I get a parsing error. Does anyone know what I did wrong?

LIST
FROM "" -#daily-note
WHERE date(2022-06-17T23:59) - file.mtime <= dur(24 hours) and date(2022-06-17T23:59) - file.mtime > dur(0 hours)
SORT file.mtime asc

It says

Expected one of the following: 

'and' or 'or', /FROM/i, EOF, FLATTEN <value> [AS <name>], GROUP BY <value> [AS <name>], LIMIT <value>, SORT field [ASC/DESC], WHERE <expression>

But I’m not that elaborate in Dataview to understand what that means in my case.

Topic

Summary
  • How to exclude the tag from the sources?

Test

Summary
  • dataview: v0.5.41

Input

Summary

dictionary files

  • Location: “100_Project/02_dataview/Q90_Duration/Q90_test_data”
  • filename : dic_20020301
---
Date: 2002-03-01
---
#person

Name:: Dwayne Johnson
BirthDate:: 1972-05-02
Title:: Fast & Furious Presents: Hobbs & Shaw
Genre:: Action, Adventure, Thriller
Year:: 2019



  • filename : dic_20020401
---
Date: 2002-04-01
---
#person

Name:: Jason Statham
BirthDate:: 1967-07-26
Title:: Transporter 3
Genre:: Action, Crime, Thriller
Year:: 2008



  • filename : dic_20020501
---
Date: 2002-05-01
---
#person

Name:: Vin Diesel
BirthDate:: 1967-07-18
Title:: F9: The Fast Saga
Genre:: Action, Crime, Thriller
Year:: 2021




DQL10_filter_by_duration_and_LIST

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL10_filter_by_duration_and_LIST duration no 1.To define a field variable F_dur_diff
2.To filter by F_dur_diff
3.To sort by file.mtime in ascending order
4.To display the result as a list

DQL10_filter_by_duration_and_LIST

Summary_code
title: DQL10_filter_by_duration_and_LIST =>1.To define a field variable `F_dur_diff` 2.To filter by F_dur_diff 3.To sort by file.mtime in ascending order 4.To display the result as a list
collapse: close
icon: 
color: 
```dataview
LIST
FROM "100_Project/02_dataview/Q90_Duration/Q90_test_data" AND !#daily-note
FLATTEN date(2022-06-17T23:59) - file.mtime AS F_dur_diff
WHERE F_dur_diff <= dur(24 hours) AND F_dur_diff > dur(0 hours)
SORT file.mtime ASC
```

Screenshots(DQL10)


Reference

Summary

I am trying to create a Dataview query that pulls in the first, uncompleted task for each file that is marked as a project.

I tried doing the following, but no dice:

TABLE
  filter(file.tasks, (t, i) => i == 0) AS "Next Action"
FROM -"Templates"
WHERE
  type = "project" AND
  status = "active"
SORT due asc

I am getting an error message that reads:

Expected one of the following:

'(', 'null', boolean, date, duration, file link, list ('[1, 2, 3]'), negated field, number, object ('{ a: 1, b: 2 }'), string, variable

Does anyone have any idea how to achieve this?

My goal is to be able to quickly see, for all of my projects, what is the “Next Action” to take, as determined by the first checkbox on the page that hasn’t been checked.

1 Like

Hi

I’m trying to add a number of fields together to get a total value for all the fields eg:

Table  sum(rows.est)  sum(rows.S1) + sum(rows.S2) + sum(rows.S3) + sum(rows.S4) + sum(rows.risk) as PpvalueTotal 
where notetype= "#pipeline"
group by "#pipeline"

However if there is more than one instance of the field in a file eg:

S1:: 10
S1:: 20

It does not work - I get:

Dataview: Every row during final data extraction failed with an error; first 3:

        - No implementation found for 'number + array'

Also stupid question but … what is the meaning of ‘rows’ lol? I’ve got this far without being able to find an explanation of what is it is anywhere !

Many thanks - that has worked !
One small favour - I don’t quite understand why and what is going on lol !?
Am I correct that there is some sort of problem with ‘null’ values ?
That mapping function therefore might be ensuring that a zero is returned where otherwise a nothing value might be returned - although I’m not sure why a null value would be returned when adding instances of fields together ?

List all unmentioned files that link to file that holds this dataview query, which haven’t been mentioned yet in the textflow otherwise.
Great for quickly creating MOC files that automatically track and list all files that link to it

list from [[]] and -outgoing([[]]) sort file.name asc

Show all recently created files with outlinks and inlinks

table 
file.outlinks as "To", file.inlinks as "From"
from "" sort file.ctime desc

Show all uncreated files (Files that are being linked to in other files but haven’t been created yet) THX @mnvwvnm

TABLE without id 
out AS "Uncreated files"
FLATTEN file.outlinks as out
WHERE !(out.file) AND !contains(meta(out).path, "/")
GROUP by out
SORT out ASC

Show all Uncreated files with origin (Files that are being linked to in other files but haven’t been created yet). THX @mnvwvnm

TABLE without id 
out AS "Uncreated files", file.link as "Origin"
FLATTEN file.outlinks as out
WHERE !(out.file) AND !contains(meta(out).path, "/")
SORT out ASC

List all outlinks and inlinks of specific file with exclusion of the file that holds this dataview query. (I use it to preview links to and from MOC files one step down the hierarchy)
Files are beeing sorted in the order they appear as links in the flowtext

list from outgoing([[FILENAME]]) or [[FILENAME]] where file.link != [[]] sort file.links asc
2 Likes

Hi Moonbase59,

Great piece of work, thank you very much!

I’ve done some testing and was wondering:

Shouldn’t
date(today).month100+date(today).day = birthday.month100+birthday.day,(date(today)-birthday).year,(date(today)-birthday).year+1) as Turns

be:
date(today).month100+date(today).day <= birthday.month100+birthday.day,(date(today)-birthday).year,(date(today)-birthday).year+1) as Turns ?

BR

Great examples. There’s not many out there on link analysis. Your post is a treatise on inlinks and outlinks.

Is it possible to do the following:

I’d like to find all outgoing links that appear in all notes in a folder, group by outgoing links with a count for each sorted desc.

Cheers!

  • Anytime!

  • It is difficult to explain it.

  • You don’t need to correct any null value. All you need to do is use the correct solution.

  • It is recommended that you should use the Conclusion in the following document because it is the correct solution.

  • You could read the DQL10, DQL20 and DQL30.

  • You may understand what happens in the DQL20_debug_sum_cash_groupBy.

  • In fact, it is necessary to understand the importance of the Conclusion. If you do not use the Conclusion, some notes are not presented in the result.

  • How to sum up a number, null, or a list of non-groupBy(or groupBy) data with skipping the null value? PS.To sum up one or two fields

So I’ve come up with this first

TABLE file.inlinks as Inlinks, length(file.inlinks) as Sum, file.outlinks as Outlinks, length(file.outlinks) as Sum, sum(length(file.inlinks)+length(file.outlinks)) as Total
FROM "path/to/folder"
SORT sum(length(file.inlinks)+length(file.outlinks)) desc, file.mtime desc

This will sort files in a folder by total of Outlinks and Inlinks. But the list will be quite big.

TABLE length(file.inlinks) as Inlinks, length(file.outlinks) as Outlinks, sum(length(file.inlinks)+length(file.outlinks)) as Total
FROM "path/to/folder"
SORT sum(length(file.inlinks)+length(file.outlinks)) desc, file.mtime desc

this is shortened to just the amounts.

I couldn’t figure out how to achieve your specific request though. But this solution should also give you an idea of “what files in a folder are the busiest”. If that’s your goal :).

Hope it helps out a bit.

Cheers

2 Likes

Very cool. Thank you!

I’ll get some learning miles out of your effort.