Show only specific tags inside a table

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.


	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 AS "Location"

There are three things I need help to accomplish:

  1. I want the column on the right (Details) to show only Parents, FabFour and Home tags; the other tags should not show up.
  2. I would like to replace the “/” for a “: ” on the tags on the right (now shown as text).
  3. 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:

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 as "Location"

Some explanations might be needed:

  1. 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)
  2. That’s easy just do a replace(string, "/", ":") where we use your previous expression to get the (list of) tags without the first character
  3. 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. :smiley:


I’m flabbergasted. :exploding_head:

Thank you so much for this. I was expecting a: “you crazy, do yaml.” :crazy_face:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.