Is it a dataview bug or is it a query error?

When I run this query creating a new daily note with Templater:

LIST
WHERE file.cday = date(<% tp.file.title %>)
SORT file.ctime DESC

on a Mac with macOS Ventura 13.2.1 and Obsidian 1.1.16, I get the following error:

Evaluation Error: SyntaxError: Unexpected identifier ‘file’
at DataviewInlineApi.eval (plugin:dataview:18370:21)
at evalInContext (plugin:dataview:18371:7)
at asyncEvalInContext (plugin:dataview:18381:32)
at DataviewJSRenderer.render (plugin:dataview:18402:19)
at DataviewRefreshableRenderer.maybeRefresh (plugin:dataview:17980:22)
at e.tryTrigger (app://obsidian.md/app.js:1:1064472)
at e.trigger (app://obsidian.md/app.js:1:1064405)
at t.trigger (app://obsidian.md/app.js:1:1841754)
at DataviewPlugin.eval (plugin:dataview:19399:76)
at s (app://obsidian.md/app.js:1:709926)
at l (app://obsidian.md/app.js:1:710032)
at r (plugin:obsidian-kindle-plugin:333:35936)

Please, what I am doing wrong?

If I don’t misunderstand completely what you want to achieve, the correct search should be

LIST
WHERE file.cday = this.file.day

No, sorry. If I change the query as you write it, I get the same error.

Both your query and alltagsverstand’s (using Templater) work for me.

I would check the other parts of the note to make sure it’s not something else jamming up Templater.

Feel free to post it here if you can’t get it and are willing. Lots of keen eyes around🧐. Forum code formatting tips are here if you aren’t familiar.

edit: Just to make sure, running Templater with other templates is fine, yes?

Yes, Templater is working fine with other templates. The problem is with dataview plugin because I create a new note that contains only the same query, and I get the same error:

Evaluation Error: SyntaxError: Unexpected identifier 'file'
    at DataviewInlineApi.eval (plugin:dataview:18370:21)
    at evalInContext (plugin:dataview:18371:7)
    at asyncEvalInContext (plugin:dataview:18381:32)
    at DataviewJSRenderer.render (plugin:dataview:18402:19)
    at DataviewRefreshableRenderer.maybeRefresh (plugin:dataview:17980:22)
    at HTMLDivElement.r (app://obsidian.md/enhance.js:1:11445)

OK, good to know it’s probably not Templater. That narrows it down (we hope).

When you get a chance, could your create a new vault, install only
Dataview, create a few untitled notes, and create a 2023-03-28 note (or your date) with only this query in it:

```dataview
LIST
WHERE file.cday = this.file.day
```

Does this query work with a test vault?

At the top of the code block, does it say:

```dataviewjs

Or:

```dataview

If you have dataviewjs you will get the error you are seeing.

1 Like

Yup. Could be.

1 Like

Indeeeeeeeeeeeed …

1 Like

Yep!!! You resolve the problem. Thank you so much!!!

1 Like

De nada. Team effort. :partying_face:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.