I can’t figure out a way to get at the path(s) for each of the notes. Is it possible to access the path for the file via the fcache.hash?
Things I have tried
I searched for “dataviewjs path” but seemed to only get code where you already know the path or something equally unrelated.
I tried dv.file.find_tfile(fname), but that results in a compile error gecause find_tfile is not defined. I guess that only works in dataview (not dataviewjs).
I tried borrowing the get_tfile code from dataview.js, but I couldn’t get that to compile (some obsidian8 variable).
I would assume there’s an easy way to do what I want, but I’m not finding it.
There are many responses to this based on how your query looks, so please present some code related to what you queries looks like just now (even though it possible doesn’t work correctly).
There are also many posts doing filtering on files and folders. If I’m not mistaken there was even one within the last fortnight.
If I was doing dataview, then I could solve the problem. It’s dataviewjs where the issue.
Here’s the start of the code (from your post). I just need to know how to get the path. I know how to write code to do the filtering once I have the path. I was hoping the path was available based on the fcache.hash. But, I haven’t found anything
const result = []
for (let [fname, fcache] of Object.entries(dv.app.metadataCache.fileCache)) {
// fname is the filename
// fcache is the entry from metadataCache.fileCache
// mcache is the actual metadataCache.metadataCache entry
const mcache = dv.app.metadataCache.metadataCache[fcache.hash]
I figured this out. I thought the fname only included the filename (w/o the path). Actually, it is the full path of the file. That makes filtering easy. So, I’m done