Dataview block vs inline query

I’m trying to return a specific set of note links. I’ve discovered that using an inline JS query can return a comma separated list, which is the format I really want, rather than a bullet list or table.

This code block produces the list I want:

LIST
FROM "Calendar/Daily" AND #monthlyreview
WHERE file.day >= date(2023-01-01) AND file.day < date(2023-01-31)

The inline JS version doesn’t work, however, but is what I need:

`$= dv.pages('"Calendar/Daily" AND #monthlyreview').where(file.day >= date(2023-01-01) AND file.day < date(2023-01-31)).file.link`

The error I get for the latter says"
Dataview (for inline JS query 'dv.pages('"Calendar/Daily" AND #monthlyreview').where(file.day >= date(2023-01-01) AND file.day < date(2023-01-31)).file.link'): SyntaxError: missing ) after argument list

but the formatting looks correct to me.

I’ve tried looking on the forums and everywhere else Google will send me. I’ve also tried various forms of the .where portion, including page => which it doesn’t like because Octal literals in 'strict mode' whatever that means (can you tell I know just enough to be dangerous?). I’ve also tried every form of quote wrapping, dataformatting, etc., that I can find to try or think of.

Does anyone know why the block works but the inline doesn’t and help me get the inline working?

Regular queries use the Dataview query language. DataviewJS is embedded JavaScript, which uses a very different syntax.

I think this might be close to what you’re trying to do:

$= dv.pages('"Calendar/Daily" AND #monthlyreview').where(page => page.file.day >= dv.date("2023-01-01") && page.file.day < dv.date("2023-12-31")).file.link

That, my friend, is exactly what I was looking for! That darned dv.date…didn’t even occur to me that I should be using that even when I did use the page.file.day. Also works brilliantly with Templater, so I can dynamically create my monthly review note!

Thanks for your help!
vwv

1 Like

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