# $if(x,y,z) not working as expected

**URL:** https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710
**Category:** Support
**Created:** [February 7, 2024, 1:57pm UTC](https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710 "2024-02-07T13:57:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Magboro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/49beb7/32.png) [@Magboro](https://community.mp3tag.de/u/Magboro)
#### Post date: [February 7, 2024, 1:57pm UTC](https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710/1 "2024-02-07T13:57:31Z")

</div>

Hi,

I am using Mp3tag v3.24 in windows 11.

I want to restructure my library using a different tree for classical music and not classical.

For classical, I want to create a directory with composer name, and for non classical, a directory for artist instead.

My conversion string is :  
D:\Lib\%genre%\%contentgroup%\$if(strcmp(%genre%,"Classical"),%composer%,%artist%)\%album%\$num(%track%,2) - %title%

if %genre% is "Classical", $if does return %composer%

But if not "Classical", $if returns nothing instead of %artist%

What am I doing wrong ?

Thanks

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [February 7, 2024, 2:19pm UTC](https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710/2 "2024-02-07T14:19:53Z")

</div>

> [@Magboro](#):
>
> $if(strcmp(%genre%,"Classical"),...  
> What am I doing wrong ?

You are missing the $ in strcmp?

Also, I think that the string constant should not have the " around it. Otherwise the genre would have to be "Classical" and not just Classical.

You can test the expression in the preview.  
I think it should be:  
`D:\Lib\%genre%\%contentgroup%\$if($strcmp(%genre%,Classical),%composer%,%artist%)\%album%\$num(%track%,2) - %title%`

---

<div class="post-metadata">

### Author: ![Magboro](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/m/49beb7/32.png) [@Magboro](https://community.mp3tag.de/u/Magboro)
#### Post date: [February 7, 2024, 2:25pm UTC](https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710/3 "2024-02-07T14:25:53Z")

</div>

Thanks. that was the missing $ ... I must have been blind.

As for the "", they do not make any difference.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [March 8, 2024, 2:26pm UTC](https://community.mp3tag.de/t/if-x-y-z-not-working-as-expected/63710/4 "2024-03-08T14:26:08Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
