How to add text to each dataview entry?

Things I have tried

TABLE "#" + tags AS Field 1
FROM ""

This does what I want it to do for the first tag I have entered, but doesn’t work for following entries.

What I’m trying to do

Im trying to add a character to each entry in a dataview query, in my case a “#” so I can view tags in the table.

I’m not sure I fully understand your request, but if you want to add the hashtag to every element of a field like tags, you might need to do something like this:

```dataview 
TABLE map(tags, (t) => "#" + t) as "Field 1"
FROM ""
```

Code untested… :slight_smile:

1 Like

yes that does what I want it to do, however I have to format my notes as:

---
tags:
- tag one
- tag two
---

instead of using:

---
tags: tag one, tag two
---

is it possible to also have it work with the second option?

Copy the following into a note, and you’ll see the difference of the three notations:

---
Tags: f54160
tagLine: tag one, tag two
tagLineList1: ["tag one", "tag two"]
tagLineList2:
- tag one
- tag two
---
questionUrl:: http://forum.obsidian.md/t//54160

`$= dv.span(dv.func.extract(dv.current(), "tagLine", "tagLineList1", "tagLineList2")) `

For me that gives this output:
image

As you can see tagLineList1 and tagLineList2 outputs as actual lists, whilst the first tagLine just holds that single value of “tag one, tag two”. So change the format to that of tagLineList1, and you can use the same expression as in my first reply.

Thank you very much for your help, this works.

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