question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug report Dataview Syntax Error

See original GitHub issue

What happened?

I’m trying to get all the text that falls under a specific header in all daily notes and compile that text from under each header into one note. The header is second level ## 3 Sentences or more on the day. Daily notes are tagged with #daily in the note and in YAML front matter.

I’ve just installed Dataview and looked at the readme and below the query is what I’ve come up with so far. Is there an error in what I wrote here, or some setting I’m missing/bug with Dataview? Inline JavaScript Queries is enabled. Have a lot of ideas with Dataview so really keen on getting this going. Thanks!

```dataviewjs const header = '## 3 Sentences or more on the day'
// You can update this to filter as you like - filtering for just your daily notes would be good const pages = dv.pages('#daily')
// This regex will return text from the Summary header, until it reaches // the next header, a horizontal line, or the end of the file const regex = new RegExp(`\n${header}\r?\n(.*?)(\n#+ |\n---|$)`, 's')
for (const page of pages) { const file = app.vault.getAbstractFileByPath(page.file.path) // Read the file contents const contents = await app.vault.read(file) // Extract the summary via regex const summary = contents.match(regex) if (summary) { // Output the header and summary dv.header(2, file.basename) dv.paragraph(summary[1].trim()) } }
```

Error message Evaluation Error: SyntaxError: Unexpected token ‘)’ at DataviewInlineApi.eval (plugin:dataview:19669:21) at evalInContext (plugin:dataview:19670:7) at asyncEvalInContext (plugin:dataview:19677:16) at DataviewJSRenderer.render (plugin:dataview:19701:19) at DataviewJSRenderer.onload (plugin:dataview:19285:14) at DataviewJSRenderer.e.load (app://obsidian.md/app.js:1:730611) at t.e.addChild (app://obsidian.md/app.js:1:731035) at Object.addChild (app://obsidian.md/app.js:1:1616830) at DataviewApi.executeJs (plugin:dataview:20210:19) at DataviewPlugin.dataviewjs (plugin:dataview:20708:18)

DQL

No response

JS

No response

Dataview Version

0.5.46

Obsidian Version

0.15.9 (installer 0.14.5)

OS

MacOS

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
blacksmithgucommented, Sep 24, 2022

The main issue is there are a bunch of squished lines (which have ~8-10 lines of code all on the same line, stuck behind // comments) - every line of code should be on a different line in the codeblock.

0reactions
daxmonsoncommented, Sep 24, 2022

I’ve sort of got what I need to do with embedded queries. Will try doing it with Dataview JS when I have time to read up on it more. Thanks for taking a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug report: SyntaxError: Unexpected token '&' · Issue #1262 ... - GitHub
Hi, I stumbled across a bug where the dataviewjs is rendered in editor mode but not in reader mode. ... Bug report: SyntaxError:...
Read more >
Use DataView filtering return syntax error - Stack Overflow
SyntaxErrorException: 'Syntax error: Missing operand after 'Name' operator.' That happens when I it try to execute dvJobs.RowFilter , I debbug ...
Read more >
Grid Filter error, Syntax error: Missing operand after '[&quot
Hi I recently upgraded to Version=2010.1.519.40 afterwards we started getting this Grid Filtering error; "Syntax error: Missing operand ...
Read more >
data source connection & syntax error with reports - IBM
With DataView IF 1.3.1.0-TIV-TNPM-IF0006, ModelMaker IF 1.3.1.0-TIV-TNPM-IF0009, and some Wireline common.
Read more >
127286 – Cannot open table in data view
Both the database and tables structures have been verified. When attempting to open a table, you get the below four (4) errors: Error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found