# An "OR" "AND" "IF" "THEN" function script wish

**URL:** https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239
**Category:** Support
**Created:** [October 31, 2009, 6:09pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239 "2009-10-31T18:09:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Windjammer](https://community.mp3tag.de/user_avatar/community.mp3tag.de/windjammer/32/68_2.png) [@Windjammer](https://community.mp3tag.de/u/Windjammer)
#### Post date: [October 31, 2009, 6:09pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/1 "2009-10-31T18:09:06Z")

</div>

I would like to have the following function and I have no idea if it's possible. Believe me, I have searched the forum for hints, but I'm not good at this and haven't found anything that resembles what I want.

I want to populate the tag %ARTIST%

IF the tag %FEATURING% has a value  
THEN I want this value copied to %ARTIST% in this format  
%ARTIST% = "Featuring: %FEATURING%"

OR  
IF the tag %FEATURING% does not exist but the tag %VOCALS% exists  
THEN I want this value copied to %ARTIST% in this format  
%ARTIST% = "Vocals by: %VOCALS%"

OR  
IF both the tags %FEATURING% AND %VOCALS% exists  
THEN I want both values copied to %ARTIST% in this format  
%ARTIST% = "Featuring:%FEATURING% with Vocals by: %VOCALS%"

OR  
IF none of the tags %FEATURING% or %VOCALS% exist  
THEN I want %BAND% values copied to %ARTIST% in this format  
%ARTIST% = %BAND%

I hope that this explanation is clear. I'll be very grateful to anyone who can help me with this.

//Windjammer

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [November 1, 2009, 11:40am UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/2 "2009-11-01T11:40:34Z")

</div>

I came up with  
_Action type:_ **Format value**  
_Field:_ **ARTIST**  
_Format string:_ **$if($and(%FEATURING%,%VOCALS%),Featuring:%FEATURING% with Vocals by: %VOCALS%,$if(%FEATURING%,Featuring: %FEATURING%,$if(%VOCALS%,Vocals by: %VOCALS%,%BAND%)))**

---

<div class="post-metadata">

### Author: ![Windjammer](https://community.mp3tag.de/user_avatar/community.mp3tag.de/windjammer/32/68_2.png) [@Windjammer](https://community.mp3tag.de/u/Windjammer)
#### Post date: [November 1, 2009, 2:35pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/3 "2009-11-01T14:35:11Z")

</div>

Hahaha! You are brilliant dano! A cosmetic space was missing in the "with" part, after the colon so here is the "perfect" code:

_Format string:_ **$if($and(%FEATURING%,%VOCALS%),Featuring: %FEATURING% with Vocals by: %VOCALS%,$if(%FEATURING%,Featuring: %FEATURING%,$if(%VOCALS%,Vocals by: %VOCALS%,%BAND%)))**

THANK YOU!

---

<div class="post-metadata">

### Author: ![Windjammer](https://community.mp3tag.de/user_avatar/community.mp3tag.de/windjammer/32/68_2.png) [@Windjammer](https://community.mp3tag.de/u/Windjammer)
#### Post date: [November 7, 2009, 9:37pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/4 "2009-11-07T21:37:55Z")

</div>

> [@dano](#):
>
> I came up with  
> _Action type:_ **Format value**  
> _Field:_ **ARTIST**  
> _Format string:_ **$if($and(%FEATURING%,%VOCALS%),Featuring:%FEATURING% with Vocals by: %VOCALS%,$if(%FEATURING%,Featuring: %FEATURING%,$if(%VOCALS%,Vocals by: %VOCALS%,%BAND%)))**

What if I have a lot more tags (more than 20) that, if they have a value, I want an new tag populated by this value semi-colon separated if more than 1? Do I have to write the $if($and( part covering all alternatives of is there a simpler way?

//Windjammer

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [November 8, 2009, 2:41pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/5 "2009-11-08T14:41:32Z")

</div>

You could use **[;%VOCALS%]** which returns  
;%VOCALS%  
if %VOCALS% has a value.

---

<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:21pm UTC](https://community.mp3tag.de/t/an-or-and-if-then-function-script-wish/9239/6 "2026-02-09T12:21:54Z")

</div>


