What I’m trying to do
I’d like to query my vault for notes containing the value “My Project” in the property “project” (that is a list) and grouping and sorting by “type” (another property)
Things I have tried
This code works:
TABLE WITHOUT ID
priority as "!!!",
file.link as Title,
file.ctime as CREAT,
file.mtime as MODIF,
project
FROM ""
WHERE contains(flat(list(project)), "2025 - Libro distopie")
SORT priority ASC
LIMIT 10
but if I change it to the following I get no results
TABLE WITHOUT ID
priority as "!!!",
rows.file.link as Title,
file.ctime as CREAT,
file.mtime as MODIF,
type as TYPE
FROM ""
FLATTEN type as T
WHERE contains(flat(list(project)), "2025 - Libro Distopie")
GROUP BY type
SORT default(((x) => {
"litnote": 1,
"hub": 2,
"zettel": 3
}[x])(Type), "99") ASC
LIMIT 5
The lines “FLATTEN…”, “GROUP…” and “SORT…” have been used in other queries and they work but they don’t when combined in this one. What am I missing?
The second issue is about the value in the project property: if it is a simple string (like the one above) the query returns results, but if I change it to a link (“[[2025 - Libro Distopie]]”), again, I get no result, what’s wrong?
Thanks!