check, if a subtrack exists, so the code must be very complex and thats -unfortunately- way too complicate and exhausting for me to fool around in this smallish-one-lin-edit-mapping-window. (no offence!! its just me :-) )
Personally I edit the string in notepad then paste it in and press "apply", with the preview dialog open, to check what the result is, and then continue to edit it if necessary.
Also, I don't understand, why there are automaticly "(" ")" when using a formatting string "$join($extend($array(%TRACK_TITLE%),%<TRACK_HIDDEN_TRACKS_TITLE>%)))"
That's just the way it is (according to Discogs guidelines it is supposed to be valid).
TRACK_INDEXTRACK_TITLE = Megamix
TRACK_SUBTRACK_TITLE = Flashback
TRACK_TITLE = Megamix (Flashback)
Something like this should work, at least for this release:
$puts(X,%TRACK_INDEXTRACK_TITLE%)$multi_if($get(X),$get(X) '(',)$ifequal(%TRACK_TOTAL_HIDDEN_TRACKS%,0,$multi_or(%TRACK_SUBTRACK_TITLE%,%TRACK_TITLE%),$join($extend($array($multi_or(%TRACK_SUBTRACK_TITLE%,%TRACK_TITLE%)),%<TRACK_HIDDEN_TRACKS_SUBTRACK_TITLE>%),' / '))$multi_if($get(X),')',)
Result:
Megamix (Music And Lights / Just An Illusion / Flashback)
Note: Since the Discogs tracklist is not really formally defined, there will always be some edge cases that are impossible to handle.