[SOLVED] Doubt - Show [Catalog number] only if value available and other than [none]

I would like my filenaming to show [Catalog number] if there is that value in the folder name, otherwise leave empty.

I am currently using

$if2(%albumartist%,%artist%)/$if2($left(%originaldate%,7),%originalyear%,$left(%date%,4),0000) - %album% ($if2(%releasecountry%,XX)-$if(%date%,$left(%date%,4),0000)) $if($eq(%catalognumber%,[none]),[%catalognumber%])
/$if($gt(%totaldiscs%,1),%discnumber%,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

which results in
Group/Original YearMonth - Album (CountryCode-Release Year) [Catalog number]/Track number Track Title.mp3

Eg.
Angelus Apatrida/2021-02 - Angelus Apatrida (XW-2021)/01 Indoctrinate.mp3
which is ok as that release does not have a catalog number

Kreator/2020-02 - London Apocalypticon_ Live at The Roundhouse (DE-2020) [27361 48105]/201 Choir of the Damned.mp3
which is ok as that release has a catalog number

However, I am also getting
Alice Cooper/2021-02 - Detroit Stories (US-2021) []/01 Rock 'n' Roll.mp3

Could anyone please clarify? If Alice Cooper’s catalog number is empty, why is it printing [] when nothing should have actually be printed?

Thank you for your support in advance.

I’m having trouble understanding how it’s working at all as you’ve written it (above). In any event, try changing:

$if($eq(%catalognumber%,[none]),[%catalognumber%])

to:

$if(%catalognumber%,[%catalognumber%])

and see if that does what you want.

1 Like

Thank you, @rdswift I overcomplicated it, no doubt. I have checked details in the database and noticed that most of the times Catalog number is simply empty. From time to time, some releases show [none] which is treated as a de facto catalog number and so printed. That’s why I was trying to find a way to deal with [none] as an empty value instead.

$if($ne(%catalognumber%,[none]),[%catalognumber%])

will print

2020-02 - London Apocalypticon_ Live at The Roundhouse (DE-2020) [27361 48105]

which is ok because that album has a catalog number that is printed. But also…

2021-02 - Detroit Stories (US-2021) []

where the two square brackets should not show. I think they are printed because catalog album is actually empty and since empty is different from [none] the square brackets are printed. I think maybe a more successful approach might be:

“if there is a catalog number and it (if) is different from [none] then print it”

So maybe two nested if’s? Do you think that is feasible? I mean your suggestion is great. Just wanted to avoid those [none] tags in the folder name,In any case, your support is appreciated so thank you once more.

Use $and to check for both not empty AND not equal to [none]:

$if($and(%catalognumber%,$ne(%catalognumber%,[none])),[%catalognumber%])
2 Likes

Aha, so that was it! Thank you @outsidecontext as well! Excellent. I’m adding [SOLVED] to the Subject line.

Thank you,

2 Likes

Actually, in your original posting you had:

$if($eq(%catalognumber%,[none]),[%catalognumber%])

rather than:

$if($ne(%catalognumber%,[none]),[%catalognumber%])

and that’s what threw me off because there was no way that it should have worked.

In any event, good to hear that you now have it working.

2 Likes