<%* const dv = app.plugins.plugins["dataview"].api;
// Define your Dataview query
const query = `TABLE WITHOUT ID file.link AS "Note Title", file.mday AS "Modified"
FROM #obsidian
WHERE type="article"
SORT file.mtime DESC`;
// Run the Dataview query and get the output as Markdown
const queryOutput = await dv.queryMarkdown(query);
// Define the name of the note where you want to output the static results
const targetFileName = "Static Dataview Output";
// Change this to your desired note name
// Find the target file in your vault
const tFile = tp.file.find_tfile(targetFileName);
// Write the query output to this file if it exists, otherwise create a new file
if (tFile) {
await app.vault.modify(tFile, queryOutput.value);
} else { await app.vault.create(targetFileName + ".md", queryOutput.value);
}
%>