Join two multivalued variables into one tag

Hi,
I’m having a hard time setting up a script that should be simple.
My goal is to combine two different variables into a single multi-valued tag. The problem is due to the “;” separator at the beginning or end of the result string that I cannot delete and which, rather than separating the values, becomes part of them.
This is a part of the latest version of the script

$set(musicbrainz_artistidtemp5,%_artists_track_additional_id%) $set(musicbrainz_artistidtemp6,%_artists_track_primary_id%)
$set(musicbrainz_artistidtemp0,%musicbrainz_artistidtemp5%, %musicbrainz_artistidtemp6%)
$setmulti(musicbrainz_artistidtemp0,%musicbrainz_artistidtemp0%)
$copymerge(musicbrainz_artistidtemp0,musicbrainz_artistidtemp0)

RESULT:

musicbrainz_artistidtemp5
(in this case the field is empty)

musicbrainz_artistidtemp6
c8e94c78-0e17-4d9a-b1f6-96e1b22ebe97

musicbrainz_artistidtemp0
;c8e94c78-0e17-4d9a-b1f6-96e1b22ebe97

Ideas? Is this too simple and am I missing something? :sweat_smile:

Try adding a new line to the end of your script as:

$cleanmulti(musicbrainz_artistidtemp0)

That should remove any empty values from the multi-value variable.

3 Likes

sometimes the solution is so simple… :grinning:

1 Like