# Problem with $if statement

**URL:** <https://community.mp3tag.de/t/problem-with-if-statement/40958>\
**Category:** Support\
**Created:** [March 3, 2018, 2:08pm UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958 "2018-03-03T14:08:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)\
**Post date:** [March 3, 2018, 2:08pm UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958/1 "2018-03-03T14:08:56Z")

</div>

> [#31]  
> T=7  
> F=%featartist%$regexp(%TITLE%,'^(.+?)\s+[[({\<]?\s\*(?:featuring|feat\.?|ft\.?)\s\*([^])}\>]+)\\>\s\*)}\>]?(.\*)$','$2$3+++$1',1)  
> 1=%featartist%+++%title%
> 
> [#32]  
> T=5  
> F=ARTIST  
> 1=$if(%FEATARTIST%,%artist%' feat. '%FEATARTIST%,)
> 
> [#33]  
> T=5  
> F=SUBTITLE  
> 1=$if($eql(%itunesadvisory%,1),Explicit,%subtitle%)
> 
> [#34]  
> T=5  
> F=SUBTITLE  
> 1=$if($eql(%itunesadvisory%,2),Clean,%subtitle%)
> 
> [#35]  
> T=5  
> F=MIXNAME  
> 1=%artist%
> 
> [#36]  
> T=7  
> F=%mixname%  
> 1=%dummy% [%mixname%]
> 
> [#37]  
> T=7  
> F=%artist%  
> 1=%artist% [%dummy%]
> 
> [#38]  
> T=5  
> F=SUBTITLE  
> 1=$if(%mixname%,%mixname% - %subtitle%,%subtitle%)
> 
> [#39]  
> T=5  
> F=TITLE  
> 1=$if(%subtitle%,%title% '['%subtitle%']',%title%)

What I'm trying to achieve is to format SUBTITLE... if MIXNAME is filled - then if SUBTITLE is filled - prepend MIXNAME to SUBTITLE - otherwise just use SUBTITLE if it is filled.

I have tried using multiple $if statements, but can't get it to work.

Below, are the following outcomes I want from SUBTITLE before appending it to TITLE.

> SUBTITLE: Clean  
> +  
> MIXNAME: Extended  
> =  
> SUBTITLE: Extended - Clean

> SUBTITLE:  
> +  
> MIXNAME: Extended  
> =  
> SUBTITLE: Extended

> SUBTITLE: Clean  
> +  
> MIXNAME:  
> =  
> SUBTITLE: Clean

And then...

> TITLE: Hello  
> +  
> SUBTITLE: Clean  
> =  
> TITLE: Hello [Clean]

> TITLE: Hello  
> +  
> SUBTITLE:  
> =  
> TITLE: Hello

---

<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:** [March 3, 2018, 3:14pm UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958/2 "2018-03-03T15:14:35Z")

</div>

> [@djdizzle](#):
>
> What I'm trying to achieve is to format SUBTITLE... if MIXNAME is filled - then if SUBTITLE is filled - prepend MIXNAME to SUBTITLE - otherwise just use SUBTITLE if it is filled

You could try an action of the type "Format value" for SUBTITLE  
Format string: [%mixartist%]%subtitle%  
The work like an IF statement.

---

<div class="post-metadata">

**Author:** ![djdizzle](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/d/ed8c4c/32.png) [@djdizzle](https://community.mp3tag.de/u/djdizzle)\
**Post date:** [March 4, 2018, 12:58am UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958/3 "2018-03-04T00:58:51Z")

</div>

> F=%featartist%$regexp(%TITLE%,'^(.+?)\s+[[({\<]?\s\*(?:featuring|feat\.?|ft\.?)\s\*([^])}\>]+)\\>\s\*)}\>]?(.\*)$','$2$3+++$1',1)  
> 1=%featartist%+++%title%
> 
> [#32]  
> T=5  
> F=ARTIST  
> 1=$if(%FEATARTIST%,%artist%' feat. '%FEATARTIST%,%artist%)
> 
> [#33]  
> T=5  
> F=SUBTITLE  
> 1=$if($eql(%itunesadvisory%,1),Explicit,%subtitle%)
> 
> [#34]  
> T=5  
> F=SUBTITLE  
> 1=$if($eql(%itunesadvisory%,2),Clean,%subtitle%)
> 
> [#35]  
> T=5  
> F=MIXNAME  
> 1=%artist%
> 
> [#36]  
> T=7  
> F=%mixname%  
> 1=%dummy% [%mixname%]
> 
> [#37]  
> T=7  
> F=%artist%  
> 1=%artist% [%dummy%]
> 
> [#38]  
> T=5  
> F=SUBTITLE  
> 1=%subtitle%[%mixname%]
> 
> [#39]  
> T=5  
> F=TITLE  
> 1=if(%title%,%title% '['%subtitle%']',)

That seems ok now, for some reason though the entire artist field is still appearing in MIXNAME, instead of being blank if there is no string enclosed in .

---

<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:** [March 4, 2018, 8:47am UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958/4 "2018-03-04T08:47:28Z")

</div>

I don't know how you create the field MIXNAME or how you want to get rid of the artist if it does not belong there.

---

<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:** [February 9, 2026, 12:27pm UTC](https://community.mp3tag.de/t/problem-with-if-statement/40958/5 "2026-02-09T12:27:15Z")

</div>


