You guessed correctly, but I think the original last line of code got deleted in the process. It started let data =
. That line defines data
, so its deletion is causing the error. Then my new line of code goes at the very end.
So the correct code should look as follows?
let page = dv.current().file.path;
let pages = new Set();
let stack = [page];
while (stack.length > 0) {
let elem = stack.pop();
let meta = dv.page(elem);
if (!meta) continue;
for (let inlink of meta.file.inlinks.concat(meta.file.outlinks).array()) {
console.log(inlink);
if (pages.has(inlink.path)) continue;
pages.add(inlink.path);
stack.push(inlink.path);
}
}
let data = dv.array(Array.from(pages)).map(p => dv.page(p));
dv.table(['Note'], data.map(p => [p.file.link]));
That doesn’t work in my case and results in the following error message:
Thanks again @scholarInTraining. I seem to be having the same issue as @altagsverstand.
This is the code I am now using:
And this is the error I receive:
Hi everyone,
Ive been reading here a lot while trying to find out a solution for my case, but so far JavaScript isnt my best friend.
I want to use the „heatmap“ plugin with a dataviewjs query to search data inside of tags. I have an example from the „tracker“ plugin.
Example Daily:
#mood:7
#pushups_sets_count:3/15
—> How would you read the data in dataviewjs to show it in the heatmap?
Would be happy about tipps.
Ah, sorry @aarontimo and @alltagsverstand - let me investigate and then I will edit this post if I can figure it out! Progress when the error message changes, but not as satisfying as getting it to work.
@ampxtreme There is a separate thread for datavewjs, but honestly I think you are more likely to get help if you start a new thread that mentions the plugins you want to combine in the title.
EDIT: @aarontimo and @alltagsverstand sorry for the delay - I figured out the issue! The example code will include links to files that do not yet exist in your vault, making some elements of that final “data” array have the value undefined
. If I filtered those out, my table worked.
NEW last two lines, filtering out the undefined pages by checking that they exist (undefined is “false-y” in Javascript):
let data = dv.array(Array.from(pages)).map(p => dv.page(p)).filter(p => p);
dv.table(['Note'], data.map(p => [p.file.link]));
If anyone ever searches for this and finds this question like I did, being disappointed that it never got an answer:
somebody has kindly sent me the CSS that enables this:
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.
I came here looking for exactly the same thing.
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
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 filter by duration?
Test
Summary
- dataview: v0.5.46
Input
Summary
dictionary files
- Location: “100_Project/02_dataview/Q90_Duration/Q90_test_data”
- filename :
dic_20020301
- file.mtime: “2002-03-03T19:30:50”
---
Date: 2002-03-01
---
#Project/P03
WorkoutDuration:: 90 minutes
- filename :
dic_20020401
- file.mtime: “2002-04-03T19:30:50”
---
Date: 2002-04-01
---
#Project/P04
WorkoutDuration:: 120 minutes
- filename :
dic_20020501
- file.mtime: “2002-05-03T19:30:50”
---
Date: 2002-05-01
---
#Project/P05
WorkoutDuration:: 3 minutes, 7 minutes
DQL10_filter_by_duration_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL10 _filter _by_duration _and_TABLE |
F_dur_diff :a duration |
no | 1.To define a field variable F_dur_diff andlet F_dur_diff = date("2002-05-03T23:59:59") - file.mtime; 2.To filter by F_dur_diff 3.To sort by file.mtime in ascending order 4.To display the result as a table |
Notes
Summary
The same codes:
- To filter the data by duration
Original Example10
```SQL
FLATTEN date("2002-05-03T23:59:59") - file.mtime AS F_dur_diff
WHERE F_dur_diff <= dur("3 months") AND F_dur_diff >= dur("0 months")
```
Another Example11
```SQL
FLATTEN (date("2002-05-03T23:59:59") - file.mtime).months AS F_dur_months
WHERE F_dur_months <= 3 AND F_dur_months >= 0
```
Another Example10B
```SQL
WHERE date("2002-05-03T23:59:59") - file.mtime <= dur("3 months") AND date("2002-05-03T23:59:59") - file.mtime >= dur("0 months")
```
Another Example11B
```SQL
WHERE (date("2002-05-03T23:59:59") - file.mtime).months <= 3 AND (date("2002-05-03T23:59:59") - file.mtime).months >= 0
```
Another Example10C
```SQL
WHERE date("2002-05-03T23:59:59") - file.mtime <= dur("3 months")
WHERE date("2002-05-03T23:59:59") - file.mtime >= dur("0 months")
```
Another Example11C
```SQL
WHERE (date("2002-05-03T23:59:59") - file.mtime).months <= 3
WHERE (date("2002-05-03T23:59:59") - file.mtime).months >= 0
```
DQL10_filter_by_duration_and_TABLE
Summary_code
title: DQL10_filter_by_duration_and_TABLE =>1.To define a field variable `F_dur_diff` and `let F_dur_diff = date("2002-05-03T23:59:59") - file.mtime;` 2.To filter by `F_dur_diff` 3.To sort by file.mtime in ascending order 4.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
file.link AS "File",
dateformat(file.mtime,"yyyy-MM-dd HH:mm:ss") AS "mtime",
F_dur_diff AS "F_dur_diff"
FROM "100_Project/02_dataview/Q90_Duration/Q90_test_data" AND !#daily-note
FLATTEN date("2002-05-03T23:59:59") - file.mtime AS F_dur_diff
WHERE F_dur_diff <= dur("3 months") AND F_dur_diff >= dur("0 months")
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.
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 !
-
You could look at
DQL20_sum_number_or_list_GROUP_BY
in the the following document. -
How to sum up a number or a list of non-groupBy(or groupBy) data with skipping the null value? PS.To sum up one field
- Problems: snowbiker100: Dataview Snippet Showcase Q641 at 2022-06-24
- Solutions: by Justdoitcc partI
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
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!