Dataviewjs, specify folder

I have this script, that shows my areas if they have an image.
I would like to define which folder it should look in, similar to From in dataview. Here it looks at that folder and all it’s subfolders.

How is that done in dataviewjs?
And yes, I’m a 100% noob when it comes to js, so the script could properly be much smarter :slight_smile:

```dataviewjs
let searchterm = dv.current().searchterm;
let pages = dv.pages(searchterm)
	.where(p => p.img != undefined && p.type)
	.where(p => p.type.includes("Area"))
	.where(p => p.type.includes("Private"))
	.sort(p => p.file.name, 'asc');
dv.table(["File","Description"],
	 pages
		 .map(p => [
		 `<img class="myTableImg" src="${this.app.vault.adapter.basePath}/${p.img.path}">`,
		 p.file.link, 
		 p.description
	 ])
 );
```

It’s the same as normal Dataview:

https://blacksmithgu.github.io/obsidian-dataview/api/code-reference/#dvpagessource

Take a single string argument, source, which is the same form as a query language source.

So just do dv.pages('"Some folder"')

1 Like

So simple, damn I feel stupid now.

Thank you

1 Like

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