Whether a markdown is existed in dataviewjs block

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

use dataviewjs to find out whether a markdown note abcd.md is existed in folder A

if the note abcd.md is existed, var thelink = [[abcd.md]], i.e., return a link to abcd.md

if abcd.md does not exist in folder A, var thelink = [[newabce.md]]

Things I have tried

let thelink
var thelink = dv.func.link(“abcd”)
if (dv.page(thelink) == null ) {
thelink = “[[new”+thelink+“]]”
} else {
thelink = “[[”+thelink+“]]”
}

However, it seems do not work.

Also, I have no idea how to specify the folder A

Just began to learn coding in order to better use this magic app.

Thanks for helps

Francis

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