"$if2" doesn't work with undefined mp3 tags

Hi,

I have some mp3 files that don’t have the Album Artist Sort Order or Artist Sort Order tags and do have Artist, but for some reason, the “$if2” doesn’t seem to work with undefined tags/values.

#1 - $upper($firstalphachar($if2(%albumartistsort%, %artistsort%, %artist%),#))/

#2 - $upper($firstalphachar($if2(%albumartistsort%, $if2(%artistsort%, %artist%)),#))/

#3 - $upper($firstalphachar($if2(%artist%, %albumartistsort%, %artistsort%),#))/

Option 1 and 2 doesn’t work, got # as the first letter option 3 gives me the “H”, which is the first letter from the artist name.

Full script:

$upper($firstalphachar($if2(%albumartistsort%, %artistsort%, %artist%),#))/

$if2(%albumartistsort%, %artistsort%, %artist%)/

$if(%date%,$left(%date%,4)) - %album%/

$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,2)/)

$num(%tracknumber%,2) - %title%

Thank you!

The scripting interprets all characters, including spaces, as part of strings. So the trick is to not set spaces:

$if2(%albumartistsort%,%artistsort%,%artist%)/
3 Likes

Thank you for the help it’s working great now. It was working before with spaces because most of the mp3 files contain the first tag (Album Artist Sort Order) that’s why.

How do I close this?

1 Like