Things I have tried
I was hoping I could use the ternary form - something like:
TABLE type AS "Type", file.tags AS "Status", file.mtime AS "Last updated"
FROM [[Personal/Personal Index]]
WHERE !contains(file.tags, "#MoC")
SORT filter(file.tags, (status) => status = "#status/on-hold" ? 1 : 0) ASC,
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?
I just don’t understand this part. To start,
filter() only works with an array. But
file.tags isn’t an array (because the
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
Maybe something like:
SORT choice(file.tags = "#status/on-hold", 2, 1) ASC, file.mtime DESC
file.tags = "#status/on-hold"replace by the number
- if not, replace by number
- once you define the ascending sort, then they list first all the
1 and then the
file.mtime DESC solves the rest
Ah, sorry, the
 shouldn’t have been there, my mistake there. I’d been changing stuff around a lot
condition ? if true : if false is a JS ternary that’s basically shorthand for
But the choice is I think what I probably do want here, thanks!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.