What I’m trying to do
I’m trying to use dataview to output a table with 5 columns: file link, lines marked with metadata “mindsum”, outgoing links starting with ~, outgoing links starting with %, outgoing links starting with $.
So it would look like this:
File | Mindsum | ~Outlinks | %Outlinks | $Outlinks |
---|---|---|---|---|
Note1 | (LIST) Lines a, b, c | (LIST) ~link1, ~link2 | (LIST) %link1 | (LIST) $link1, $link2 |
Note2 | (LIST) Lines a, b | (LIST) ~link1, ~link2, ~link3 | (LIST) %link1, %link2 | (LIST) $link1 |
Note3 | (LIST) Lines a | (LIST) ~link1 | (LIST) %link1, %link2 | (LIST) $link1, $link2 |
I currently have a query to output all the outlinks in one column:
TABLE mindsum, file.outlinks
FROM [[]]
WHERE mindsum
SORT file.name ASCENDING
I‘m struggling with breaking up the outlinks into different columns.
(A second approach I’d be open to: Having the single column of outlinks sorted by first letter, instead of divided into different columns.)
Any suggestions would be incredibly helpful – thank you in advance!
Things I have tried
In my searches, I came across FILTER, startswith, and WHERE example[0] = but I can’t seem to figure out the correct way to incorporate them into the query.
Apologies in advance for twitch-worthy syntax, and if using special characters in the filename is the big no-no – it’s my first rodeo.
Filtering
TABLE
mindsum,
filter(file.outlinks, (l) => l.startsWith("~")) as ~Outlinks,
filter(file.outlinks, (l) => l.startsWith("%")) as %Outlinks,
filter(file.outlinks, (l) => l.startsWith("$")) as $Outlinks,
FROM [[]]
WHERE mindsum
… gives me an error message saying “Cannot call type ‘null’ as a function”
Where first letter
TABLE
mindsum, file.outlinks as "~Outlinks", file.outlinks as "%Outlinks", file.outlinks as "$Outlinks"
FROM [[]]
WHERE mindsum
WHERE "~Outlinks"[0] = "~"
WHERE "%Outlinks"[0] = "%"
WHERE "$Outlinks"[0] = "$"
… outputs all outlinks in all outlink columns (i.e. not just those that start with ~ or % or $).