# New tag from existing tags

**URL:** https://community.mp3tag.de/t/new-tag-from-existing-tags/65820
**Category:** Support
**Created:** [September 3, 2024, 10:00pm UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820 "2024-09-03T22:00:13Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 3, 2024, 10:00pm UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/1 "2024-09-03T22:00:13Z")

</div>

Hi,  
I need some help. I would like to create a new tag that contains the information of other tags already present in the file.

Example:

Tags in the file:  
`%engineer%` --\> `Name A`; `Name B`; `Name C`  
`%mastering%` --\> `Name A`  
`%assistant mixer%` --\> `Name A`; `Name B`

New Tag:

`%New Tag%` --\> `Name A - engineer`; `Name B - engineer`; `Name C - engineer`; `Name A - mastering`; `Name A - assistant mixer`; `Name B - assistant mixer`

Is it possible to do this?

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 4, 2024, 4:59am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/2 "2024-09-04T04:59:22Z")

</div>

Create an action of the type "Format value" or "Convert\>Tag-Tag" for NEW TAG  
Format string: `$replace(%engineer%,;, - engineer;) - engineer; $replace(%mastering%,;, - mastering;) - mastering; $replace(%assistant mixer%,;, - assistant mixer;) - assistant mixer`

---

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 4, 2024, 7:15am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/3 "2024-09-04T07:15:05Z")

</div>

I tried but it doesn't work properly. It seems that you don't consider multi-valued tags

These are the tags of my test file

 ![Immagine 2024-09-04 085747](https://community.mp3tag.de/uploads/default/original/3X/9/7/974d8105886eabc5d2db39f6d91aa036543411b0.jpeg)

this is the conversion screen

 ![image](https://community.mp3tag.de/uploads/default/original/3X/0/4/043ad3ea8c44e97839972e796f7d85d833562196.png)

I would also like to build the script based on a set of standard tags and, when I execute the action, only the tags present in that specific file are written in the new tag (example: in the script there is `%assistant mixer%` and `%mastering%`, but in the specific file there is only `%mastering%`, the new tag will only have the value `Name - mastering` and nothing else)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 4, 2024, 7:28am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/4 "2024-09-04T07:28:56Z")

</div>

> [@Daniel82](#):
>
> It seems that you don't consider multi-valued tags

I do not think the I did not consider the multi-value tags but that you did not mention them in the first place. So it is the GIGO principle - garbage in, garbage out.

Replace the reference to the tag field with `$meta_sep(tagfieldname,; )` to get the multi-value fields into a single string.

I would then split the single action into several actions in that action group - 1 for each field that could be there or not - an then enclose the $replace() statement into $if2(), e.g.  
`%new tag%$if2(%mastering%,$replace($meta_sep(mastering%,; ),;, - mastering;),)`  
Or you create multi-value fields again for %new tag% with  
`%new tag%\\$if2(%mastering%,$replace($meta_sep(mastering%,; ),;, - mastering\\),)`

---

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 4, 2024, 8:05am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/5 "2024-09-04T08:05:58Z")

</div>

> I do not think the I did not consider the multi-value tags but that you did not mention them in the first place. So it is the GIGO principle - garbage in, garbage out.

Sorry, that was a translation error. I didn't mean that you didn't consider the multi-value tag, but that the function as it was written seemed not to consider multi-value tags.  
As soon as I get home I'll try this.  
In the meantime, thanks

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [September 4, 2024, 9:02am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/6 "2024-09-04T09:02:33Z")

</div>

> [@Daniel82](#):
>
> `%New Tag%` --\> `Name A - engineer`; `Name B - engineer`; `Name C - engineer`; `Name A - mastering`; `Name A - assistant mixer`; `Name B - assistant mixer`

You should consider, that the custom tag field "New Tag" you provided, actually seems to correspond to the official tag field "INVOLVEDPEOPLE". However, this has an opposite rule for how it is filled with data, e.g.  
`engineer:Name A;`

> **[Tag Field Mappings – Mp3tag Documentation](https://docs.mp3tag.de/mapping/#involvedpeople)**
>
> Overview of all available tag fields, their names in Mp3tag, and how they are mapped to the internal structures of the different tag formats. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 4, 2024, 10:19am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/7 "2024-09-04T10:19:27Z")

</div>

> [@ohrenkino](#):
>
> I would then split the single action into several actions in that action group - 1 for each field that could be there or not - an then enclose the $replace() statement into $if2(), e.g.  
> `%new tag%$if2(%mastering%,$replace($meta_sep(mastering%,; ),;, - mastering;),)`  
> Or you create multi-value fields again for %new tag% with  
> `%new tag%\\$if2(%mastering%,$replace($meta_sep(mastering%,; ),;, - mastering\\),)`

I tried using the second solution you wrote

`%new tag%\\$if2(%engineer%,$replace($meta_sep(engineer,; ),;, - engineer\\),)`

but it returned the error "Invalid IF2 syntax", so I changed it by removing `%engineer%` after the round bracket `$if2`

`%new tag%\\$if2($replace($meta_sep(engineer,;),;, - engineer\\),)`

this works better except for the last value of the tag where it doesn't add `- engineer`

 ![image](https://community.mp3tag.de/uploads/default/original/3X/3/b/3b1e481476cde1413909e9a6ada3d8e732c8c35c.png)

I also tried to create the action group for these 3 fields, but something strange happens. As if the various actions overwrite the tags

 ![image](https://community.mp3tag.de/uploads/default/original/3X/0/0/00c0775947bbcdaa14a8b521ed5e46e4c4388b5a.png)

 ![image](https://community.mp3tag.de/uploads/default/original/3X/e/e/ee3bde12c0fdf4bcd3168dca33e990aa15830360.png)

> [@New tag from existing tags](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/6):
>
> You should consider, that the custom tag field "New Tag" you provided, actually seems to correspond to the official tag field "INVOLVEDPEOPLE". However, this has an opposite rule for how it is filled with data, e.g. engineer:Name A;

Hi,  
actually the final tag will be called `PERSONNEL` used by Roon and the format is `Name - Role`.

My intent is to write in PERSONNEL all the single tags that I already have in the files by getting the role and attribute from musicbrainz (mastering, remastering, assistant , additional, co-, sound engineer, artwork, design...), with the correct "role" string for Roon

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 4, 2024, 10:43am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/8 "2024-09-04T10:43:36Z")

</div>

if you want to use several tags of the type NEW TAG then you would have to join the field to become a single field with `$meta_sep(new tag,\\)` before you can add further data. Otherwise only the first instance of the field is taken.

---

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 4, 2024, 11:02am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/9 "2024-09-04T11:02:57Z")

</div>

Perfect, thanks.  
This works and creates the correct number of tags

`$meta_sep(new tag,\\)\\$if2($replace($meta_sep(engineer,;),;, - engineer\\),)`

I still have the problem that it doesn't add the role string to the end of the last tag value. I've tried several times to change it but without success 🤔

![image](https://community.mp3tag.de/uploads/default/original/3X/0/a/0a6edf43b1379ad92e689e622607348f7c9015bf.png)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 4, 2024, 11:15am UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/10 "2024-09-04T11:15:17Z")

</div>

> [@Daniel82](#):
>
> $meta\_sep(new tag,\)\$if2($replace($meta\_sep(engineer,;),;, - engineer\),)

I think you need  
`$meta_sep(new tag,\\)\\$if2($replace($meta_sep(engineer,;),;, - engineer\\) - engineer\\,)`

---

<div class="post-metadata">

### Author: ![Daniel82](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/67e7ee/32.png) [@Daniel82](https://community.mp3tag.de/u/Daniel82)
#### Post date: [September 4, 2024, 12:14pm UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/11 "2024-09-04T12:14:32Z")

</div>

It works! Thanks again

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [October 4, 2024, 12:15pm UTC](https://community.mp3tag.de/t/new-tag-from-existing-tags/65820/12 "2024-10-04T12:15:18Z")

</div>

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