Passing arguments in DataviewJS dv.view() doesn't seem to work?

I looked closely at the documentation DataviewJS dv.view() but I’ve been having trouble getting it to work. I have this JS under Scripts/tasks.js whichj also uses the Metadata Menu plugin:

const { fieldModifier: f } = this.app.plugins.plugins["metadata-menu"].api;
const { query } = input

dv.table(
    ["Tasks"], 
    await Promise.all(
        dv.pages(query)
            .sort(b => -b.AtomicID)
            .map(async d => [
                d.file.link,
                f(dv, d, "Date Started"),
            ])
    ),
);

And I make this query:

```dataviewjs
await dv.view("Scripts/tasks", {query: "'#Obsidian-Tasks'"});
```

but its empty. This is a shorter version of a longer query I’ve been trying to work with a lot more columns. It works fine when I write in something for query right on the script. Can someone tell me what I’m doing wrong if anything or how to troubleshoot it?

Your query parameter value is wrong. You’ve added an extra pair of quotes

It should be:

await dv.view("Scripts/tasks", {query: '#Obsidian-Tasks'});
2 Likes

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