I was hoping I could use the ternary form - something like:
TABLE type AS "Type", file.tags[0] AS "Status", file.mtime AS "Last updated"
FROM [[Personal/Personal Index]]
WHERE !contains(file.tags, "#MoC")
SORT filter(file.tags[0], (status) => status = "#status/on-hold" ? 1 : 0) ASC,
file.mtime DESC
but that doesn’t seem to be valid.
What I’m trying to do
I want to sort a specific status to the bottom of a table, but leave everything else sorted on date. Is this possible with dataview or do I need to fall back to dataviewjs here?
(I guess ideally it would be nice to be able to leave the TABLE in a dataviewjs script and just define a function for the filtering, but that doesn’t work either - I guess it’s all js or no js and mix-and-match is out?
Hi.
I just don’t understand this part. To start, filter() only works with an array. But file.tags[0] isn’t an array (because the [0]).
This part - "#status/on-hold" ? 1 : 0 I just don’t understand what it means. I guess is a JS code, but you can’t use js in dql queries (only the functions defined… well, the use of => is similar, but with a defined syntax).
I guess you need to use the function choice().
Maybe something like: