# Write multiple tags of the same name to a single track

**URL:** https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506
**Category:** Web Sources Discussion
**Created:** [December 13, 2021, 6:34pm UTC](https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506 "2021-12-13T18:34:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mr\_bug](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3bc359/32.png) [@mr\_bug](https://community.mp3tag.de/u/mr_bug)
#### Post date: [December 13, 2021, 6:34pm UTC](https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506/1 "2021-12-13T18:34:49Z")

</div>

Something I'd like to see improved is the ability to write to multiple tags of the same name to a single track via the script. Currently, one writes to a single tag with a unique string of characters between each value (e.g. `val1#!#val2`) which can later then be replaced with `\\` using an Mp3tag action to split into multiple. Preferably this wouldn't be a two-step process, but be possible via the script somehow.

A simplified example:

```json
json_foreach "tags"
    json_select "name"
    set "tmp"
    outputto "tmp"
    sayrest
    outputto "tmp_genre"
    ifoutput "tmp_genre"
        say "#!#"
    endif
    sayoutput "tmp"
json_foreach_end
outputto "genre"
sayoutput "tmp_genre"

```

We use `|` to write to the same tag across different tracks, but there is no way to write to multiple tags of the same name for the currently processed track as far as I know.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 15, 2021, 5:18pm UTC](https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506/2 "2021-12-15T17:18:45Z")

</div>

Can you try this preliminary version

[https://download.mp3tag.de/support/BEC24A86-ECE4-4F65-BC75-A439E84B7B86-3-11-6-3/mp3tagv311f3setup.exe](https://download.mp3tag.de/support/BEC24A86-ECE4-4F65-BC75-A439E84B7B86-3-11-6-3/mp3tagv311f3setup.exe)

with `say "\\\\"` to produce multiple fields.

---

<div class="post-metadata">

### Author: ![mr\_bug](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/3bc359/32.png) [@mr\_bug](https://community.mp3tag.de/u/mr_bug)
#### Post date: [December 16, 2021, 8:20am UTC](https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506/3 "2021-12-16T08:20:24Z")

</div>

Appears to work as intended; Multiple tags are split correctly on a per-track basis, thanks!

I've noticed that in one of your bundled scripts you use `replace "|" "$verticalBar()"`. I'm assuming it's a good idea to write some equivalent, such as `replace "\\" "$doubleBackslash()"` at the top. Or should it be `"\\\\"`?

The questions I have are:

- Is `$verticalBar()` something that Mp3tag handles internally? If so...
- What is the correct `$variable` for this backslash sequence of characters? It's rare but possible that a value may contain the number of backslashes needed to cause a split.

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 16, 2021, 5:08pm UTC](https://community.mp3tag.de/t/write-multiple-tags-of-the-same-name-to-a-single-track/55506/4 "2021-12-16T17:08:27Z")

</div>

I don't want to add this preemptively — if this is going to become a problem I can do something about it.
