Dataview listening tags

How to filter all tags following after index/xxx?

So how to get the results xxx? Which are all different. Any suggestions?

Thanks a lot!!!

What have you tried already?

HI, thanks. Yes I tried some lines. But I cannot find the last solution. This is what is have till now:

TABLE WITHOUT ID
	file.etags AS Index,
	file.link AS Definitions,
	length(file.inlinks) as "In"
FROM "3_Permanent Notes"
WHERE contains(file.etags,"index")
SORT file.name ASC

The result is ok, but I want that only the index/xxx tag is shown in the table. There are many more tags in the properties of one note, but for this table they do not need to show up.

How to do this, can someone point me to the right direction?

Thanks!

Instead of file.etags as Index you can use filter(file.etags, (t) => contains(t, "index")) as Index

1 Like

Hey, wow! Thanks! Saw the filter option in the guide but could not get it properly to work. what does “t” mean?

And do you know if it is possible to not have visible rendered “index/” int he table results? Well, if not possible or too complex it does not matter that much. I am really happy with the result till so far :slight_smile:

Filter loops through the list you give it, in this case file.etags, and assigns them to a temporary variable which I chose to call (t). This is then used to check (each) tag in the expression contains(t, "index").

You can use a similar construct to remove the start of your tags by using map(), but then you lose the tag link? Do you want that to happen?

1 Like

Thanks! You are right, I will leave it like this. Thanks so far!

Actually, if you can point me to the right direction it would be helpfull using map( ). Cause the index/xxx tag is unique i don’t need the tag link anyway.

Thanks!

Can you help me to point me to the right direction of using map ()? Where to place this and with which parameters?

Thanks!

It can be done in a few ways, but here is one variant:

```dataview
TABLE WITHOUT ID
	Index,
	file.link AS Definitions,
	length(file.inlinks) as "In"
FROM "3_Permanent Notes"
WHERE contains(file.etags, "#index/")
FLATTEN map(
  filter(
    file.etags, 
    (t) => startswith(t, "#index/")),
  (m) => substring(m, 7)) as Index
SORT Index DESC, file.name ASC
```

The explanation is almost the same as for the FLATTEN filter(...), but we wrap the FILTER in another layer with map( filter(...), (m) => ...) and the mapping done is just to extract the last part of the tag text.

Thank you! Works!