New tag from existing tags

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?

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

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

this is the conversion screen

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)

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\\),)

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

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;

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

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

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

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.

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 :thinking:

image

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

It works! Thanks again