Dataview: Error:
-- PARSING FAILED --------------------------------------------------
1 | LIST
> 2 | FROM [[my_note]].file.folder
| ^
Expected one of the following:
'and' or 'or', /FROM/i, EOF, FLATTEN <value> [AS <name>], GROUP BY <value> [AS <name>], LIMIT <value>, SORT field [ASC/DESC], WHERE <expression>
I just don’t know why this is not working…
Things I have tried
In the inline mode, =[[my_note]].file.folder returns the folder path of the note.
Also, =typeof([[my_note]].file.folder) returns sting.
I expected FROM to accept string as we often do FROM "the_dir" for dataview filterings.
Or, Maybe, links are not working in the dataview query as it does in elsewhere…?
this works because this thing is a dataview query itself. it returns the correct folder.
the FROM [[my_notes]].file.folder thing youre trying wont work because FROM isnt getting the result of the query (the_dir); its getting the query text itself ([[my_note]].file.folder).
since you cant nest queries, my suggestion is to simply get the folder path of whatever note it is and use that instead, as in the normal way
I didn’t know FROM does not accept strings from query outputs.
Did you mean “the normal way” as FROM "the_dir" ?
What I wanted to do was to dynamically set the source.
For example, even if I change the title of my_note to my_note_modified, the dataview query keeps up to date. (with an assumption that my_note is always in the same folder in any case)
Do you have an idea for such dynamic filtering?
In my case, I wanted to restrict the search pool (i.e. source of the query) for faster response.
I don’t fully understand how the dataview query works under the hood. But, a WHERE clause checks every file in the vault without FROM clause, in my understanding.
I get what you’re saying regarding WHERE vs FROM, but I do believe in this case you’re mostly handling metadata meaning it’s not as expensive as if you actually had to read each and every of your vault.
In the latter case it would be crucial to limit the initial set better. The same would apply if one needed to expand/flatten all lists before proceeding as that could be a rather large data set. However, I’m not sure when we’re leaving cached metadata, and have to resort to file reading.
So it’s a valid concern, but I don’t think you would notice any difference in your case.
I often flatten texts of the lists in the (filtered) files to see the lines containing a certain inline metadata, although I understand Dataview plugin is for querying file-level (meta)data.
I think I have to stay with WHERE right now as I don’t see a way of dynamic filtering in Dataview.