Hi!
I’m trying to make a table showing only specific tags from notes in my VAULT. I’m not a programmer so it’s mostly reading, trial an error for me… and after long hours on testing stuff, this is the closest I could get.
dataview
TABLE
substring(rows.file.etags, 1) AS "Details"
FROM #FabFour OR #Home OR #Parents
FLATTEN join(file.etags) AS Tags
WHERE contains(Tags, "#FabFour") OR contains(Tags, "#Parents") OR contains(Tags, "#Home")
GROUP BY file.link AS "Location"
There are three things I need help to accomplish:
I want the column on the right (Details) to show only Parents, FabFour and Home tags; the other tags should not show up.
I would like to replace the “/” for a “: ” on the tags on the right (now shown as text).
Is it possible to remove the thing there in the center that I marked with the yellow circle?
I don’t know if what I’m asking is hard or even possible, but thanks in advance for your help!
Try this query and see if it meets your requirements:
```dataview
TABLE flat(replace(substring(rows.Tags, 1), "/", ":")) as "Details"
FROM #FabFour OR #Home OR #Parents
WHERE file.folder = this.file.folder
FLATTEN array(filter( file.etags, (t) =>
startswith(t, "#FabFour") OR
startswith(t, "#Parents") OR
startswith(t, "#Home") )) as Tags
WHERE length(Tags) > 0
GROUP BY file.link as "Location"
```
Some explanations might be needed:
Instead of that mysterious combination of join() and contains(), we execute an array(filter( ... )) as Tags to pick out the tags we want, and group them back as an array into Tags. This removes all other tags. In order for the query to only show files with either of these tags, we check for length(Tags) > 0 in the WHERE clause. (Theoretically it shouldn’t be needed due to the FROM clause, so do try it without the WHERE clause)
That’s easy just do a replace(string, "/", ":") where we use your previous expression to get the (list of) tags without the first character
The result of your query is actually a list of lists, so by applying flat( ... ) we remove the outer list level, and we get only the actual list of entries
So in conclusion, it’s possible, but it do require some trickery and careful navigation of list manipulation, and you’re welcome. Sorry it took me a few days to conjure up this query.