obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

relative path support

Open vitaly opened this issue 2 years ago • 13 comments

Currently it's a pain to write a generic queryfor "everything in current folder", as you can't do LIST FROM this.file.folder

I think something like LIST FROM "." or LIST FROM "./subfolder" would be nice

vitaly avatar Oct 02 '21 09:10 vitaly

I've actually added relative path resolution for some DataviewJS work, so I can probably extend it to queries at this point.

blacksmithgu avatar Oct 02 '21 19:10 blacksmithgu

This would be very useful - was it implemented? I don't seem to be able to get it working.

ronanchilvers avatar Jul 03 '22 06:07 ronanchilvers

Also running into this issue, support for relative paths would be great.

Judp0m avatar Jul 19 '22 05:07 Judp0m

Any update on this? This feature would allow users to submodule obsidian repos. Right now dataview will only render in the primary repo if the submodule uses absolute path, which breaks the submodule repo

hgrw avatar Aug 09 '22 21:08 hgrw

I know the following doesn't work:

LIST FROM this.file.folder

BUT, is there an equivalent using DataviewJS?

amejiarosario avatar Nov 04 '22 00:11 amejiarosario

dv.current().file.folder. In DQL, you can use a where condition where file.path = this.file.path.

AB1908 avatar Nov 04 '22 08:11 AB1908

This dataviewjs worked!

dv.list(dv.pages('"' + dv.current().file.folder + '"').file.path)

But, I couldn't get the DQL to work (it's always empty)

task from "journals/2022"
WHERE file.path = this.file.path

amejiarosario avatar Nov 05 '22 21:11 amejiarosario

That's weird. Are you sure the path is correct and doesn't have typos? What's the output of dv.current().file.folder?

AB1908 avatar Nov 05 '22 22:11 AB1908

Hello,

You can do that with help of the folder, not the path implicit field:

LIST
WHERE file.folder = this.file.folder

Path contains the file name, folder does not.

s-blu avatar Dec 02 '22 14:12 s-blu

Thank you. I see it interprets the string, allow me to extend your example for those wanting to point to a relative dir. E.g. in the current dir we have a subfolder recipes, then we can use:

WHERE file.folder = this.file.folder + "/recipes"

Hello,

You can do that with help of the folder, not the path implicit field:

LIST
WHERE file.folder = this.file.folder

Path contains the file name, folder does not.

n-batalha avatar May 02 '23 19:05 n-batalha

any news on this?

obvionaoe avatar Aug 15 '23 16:08 obvionaoe

any news on this?

This works for me currently.

table without id
   file.name as "Revision Date",
  author,
  comment
from #revision 
	where file.folder = this.file.folder + "/revisions"

KairuDeibisu avatar Oct 10 '23 17:10 KairuDeibisu

I would like to add my vote for this feature request.

bharker75 avatar Jan 19 '24 15:01 bharker75