How to generate a column that filters out selected tags

Hi

I currently have this dataview

TABLE WITHOUT ID
file.link as Note,
filter(file.etags, (x) => !contains(x,"#change-my-day")) as Tags2
FROM #change-my-day 
SORT file.mtime DESC

which generates a column showing all tags other than the one I don’t want (“change-my-day”).

What I want to do is ALSO exclude the tag “#journal”. Anyone have any ideas what I need to do to generate this?

1 Like

You could try the following query:
````ad-info
title: DQL10_filter_by_file.etags
collapse: close
icon:
color:

TABLE WITHOUT ID
      file.link AS Note,
      file.etags AS Tags2
FROM #change-my-day 
WHERE !contains(file.etags,"#change-my-day") AND
      !contains(file.etags,"#journal")
SORT file.mtime DESC

````
Good luck! I hope this helps.

Hi. Thanks for your response. Just to clarify; I don’t want to exclude any files. I just want to exclude the display of specific tags of the files (in my WHERE clause). In other words I want a column that shows all tags other than #change-my-day and #journal

You could try the following query:
````ad-info
title: DQL20_filter_by_file.etags_excluding-no-files
collapse: close
icon:
color:

TABLE WITHOUT ID
      file.link AS Note,
      filter(
          file.etags,
          (x) => !contains(x, "#change-my-day") AND !contains(x, "#journal")
      ) as Tags2
FROM #change-my-day 
SORT file.mtime DESC

````

Good luck! I hope this helps.

2 Likes

There are many ways to write this! One way would be to change the second arg of filter to (x) => all(!contains(x, "#change-my-day"), !contains(x, "#journal)). Or you could get rid of the ! and change all to none.

thank you!!

is there a way to exclude MULTIPLE tags?

I mean, not just one as in this example

1 Like

Yes, my example at the bottom of my post showed for 2 tags. If you have many, you might want to put them in their own list and use all/any/none with that list inside the all for tags.

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