What I’m trying to do
Briefly, I want to update a dataview query so that notes that either have no tags at all or no kind/*
tag appear to be tagged with kind/unknown
.
I have a query that returns all notes related to a project, sorted/grouped by tag:
TABLE WITHOUT ID eTags AS "Kind", rows.file.link AS "Files"
FROM #Projects/ProjectNameHere OR "Projects/ProjectNameHere"
FLATTEN file.etags AS eTags
WHERE contains(eTags, "#kind/")
WHERE !contains(eTags, "#kind/project/index")
GROUP BY eTags
SORT Tags DESC
This works well; any note in Projects/ProjectNameHere
OR tagged #Projects/ProjectNameHere
shows up in the list AS LONG AS the file ALSO has a tag that begins with kind/
.
I am trying to expand this to display notes that are either not tagged at all or notes that do not have a tag beginning with kind/
Things I have tried
Before even trying to complicate with conditionals, I figured that I would start with simply “injecting” a faux tag into any note that doesn’t have any tags via default() but this doesn’t seem to work:
TABLE WITHOUT ID eTags AS "Kind", rows.file.link AS "Files"
FROM #Projects/ProjectNameHere OR "Projects/ProjectNameHere"
WHERE default(file.etags, "#kind/unknown")
FLATTEN file.etags AS eTags
WHERE contains(eTags, "#kind/")
WHERE !contains(eTags, "#kind/project/index")
GROUP BY eTags
SORT Tags DESC
I created an empty note (Projects/ProjectNameHere/i-am-empty.md
) with no content and thus no tags and I do not see that note in the rendered view.
Likewise, changing the type:
WHERE default(file.etags, ["#kind/unknown"])
Does not work, either.
I do not know how to inspect/debug the query so I have no clue if default()
is doing anything.
Thoughts?