Wrong syntax wrapping dataview query into a template?

What I’m trying to do

Can anyone understand how this dataview query works fine but then stops working when wrapped into a template?
I am just trying to find pages WHERE their ‘date’ is bigger than the ‘date’ of the current file [[]].date and then pick the first one in the ascending order.

Things I have tried

Using this query I get the link to the note that happened right after this one. And yes render the link in markdown (I am open to ideas if you have a better way).

Working:

LIST WHERE (date > [[]].date) SORT date ASC  LIMIT 1

Not working:
<%*
const dv = app.plugins.plugins[“dataview”].api;
const te = await dv.queryMarkdown(“LIST WHERE (date > [[]].date) SORT date ASC LIMIT 1”);
tR += te.value;
%>

Thanks!

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