Well, I never used some similar to this query. But I accepted the challenge as a way to learn more about the potential of Dataview.
Because many of the hypotheses are found by the “trial-error” method (not any special knowledge in code), in some cases things seems to work in my limited test vault. But, applied to a more complex vault, the issues becomes more specific.
In this particular issue, I deduce the problem is in
file.link. What is a link? Is a file path… rendered with the file name. So, I deduce the function
file.link is applied to the file path (something like
Folder2/Adorno.md > all files in
Folder1 are sorted before files in
How to overcome this limitation?
The immediate answer is use
file.name instead of
sort(rows.file.name) AS Files
But (now is my turn), you want “links”, not a simple list of names.
To do that, let’s try the function
link presented in the plugin documentation:
link(sort(rows.file.name)) AS Files
In conclusion, try this query and tell me if my empiric deduction works:
TABLE WITHOUT ID (tag + "(" + length(rows.file.link) + ")") AS Tags, link(sort(rows.file.name)) AS Files
FLATTEN file.tags AS tag
GROUP BY tag
SORT length(rows.file.link) DESC