# Conditional action

**URL:** https://community.mp3tag.de/t/conditional-action/10724
**Category:** Support
**Created:** [August 26, 2010, 10:34pm UTC](https://community.mp3tag.de/t/conditional-action/10724 "2010-08-26T22:34:13Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 26, 2010, 10:34pm UTC](https://community.mp3tag.de/t/conditional-action/10724/1 "2010-08-26T22:34:13Z")

</div>

I have an action to collect all standard fields values into a custom field and then wipe the standard fields...

... but how may I arrange it to operate only on tracks that it has not already operated on?

Thanks.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 26, 2010, 11:44pm UTC](https://community.mp3tag.de/t/conditional-action/10724/2 "2010-08-26T23:44:24Z")

</div>

> [@chrisjj](#):
>
> I have an action to collect all standatd fields values into a custom field and then wipe the standard fields...  
> ... but how may I arrange it to operate only on tracks that it has not already opererated on?  
> Thanks.

You can filter the view.  
You can check for an existing field.  
Why do you collect many field's values into one field and remove the original fields?  
How would you describe what is a standard field and what is a custom field?

DD.20100827.0345.CEST

---

<div class="post-metadata">

### Author: ![JJ\_Johnson](https://community.mp3tag.de/user_avatar/community.mp3tag.de/jj_johnson/32/67_2.png) [@JJ\_Johnson](https://community.mp3tag.de/u/JJ_Johnson)
#### Post date: [August 27, 2010, 3:57am UTC](https://community.mp3tag.de/t/conditional-action/10724/3 "2010-08-27T03:57:48Z")

</div>

If it's an action _group_ then it's not always easy. I've been asking for a special action that would exit an action group if a condition evaluates to TRUE. That way you could set up an action group that would only be executed conditionally, or could be partially executed.

Right now filtering is probably the cleanest way to do what you want.

Without filtering, one fairly cumbersome way is to use $if() statements that check for the existence of a field. The $if() would have to be included in the value for each action in the group and would only work for actions that set a value.

_Action type:_ **Format value**  
_Field:_ **MYCUSTOMFIELD**  
_Format string:_ **$if(%mycustomfield%,%mycustomfield%,%artist%;%album%;%title%;...etc...)**

This would look for MYCUSTOMFIELD and if it already exists, will leave the value intact, else it will join those other fields. If your action group takes several steps to accomplish this then you'll need the $if() statement in each one.

A 'Remove fields' action can't be executed conditionally, but you can kludge something similar by setting a field's value to an empty string. Setting a field to an empty string will delete it.

_Action type:_ **Format value**  
_Field:_ **ARTIST**  
_Format string:_ **$if(%mycustomfield%,,%artist%)**

This would check for the existence of MYCUSTOMFIELD and remove ARTIST if that field exists, otherwise it will leave ARTIST unchanged. You would need an action like this for each field that you want to delete.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 27, 2010, 7:29am UTC](https://community.mp3tag.de/t/conditional-action/10724/4 "2010-08-27T07:29:40Z")

</div>

> [@DetlevD](#):
>
> You can filter the view.

Sorry to be unclear. I meant _automatically_. I.e. in the action script.

> [@DetlevD](#):
>
> You can check for an existing field.

I can find no way to do that in an action to meet the stated requirement.

> [@](#):
>
> Why do you collect many field's values into one field and remove the original fields?

To hide the metadata from the likes of Baidu, whilst retaining it for debugging.

> [@](#):
>
> How would you describe what is a standard field and what is a custom field?

Simply by referencing them:

**Format value "CJJTAGS": %album% %discnumber% %track% ~ %artist% ~ %title%  
Remove fields except "CJJTAGS"**

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [August 27, 2010, 7:53am UTC](https://community.mp3tag.de/t/conditional-action/10724/5 "2010-08-27T07:53:11Z")

</div>

> [@JJ Johnson](#):
>
> Without filtering, one fairly cumbersome way is to use $if() statements that check for the existence of a field.

Thanks. That's the also least cumbersome way I have found 🙂

> [@](#):
>
> A 'Remove fields' action can't be executed conditionally

Since my reply to Detlev, I find I can get away without that conditional:

**Format value "CJJTAGS": $if(%cjjtags%,%cjjtags%,$list(,:","|))  
Remove fields except "CJJTAGS'**  
   
The above is a slight compromise in that it copies all fields rather than just standard ones but this is acceptable, and worthwhile to simplify coding.

Thanks again, JJ and DD.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 28, 2010, 4:40am UTC](https://community.mp3tag.de/t/conditional-action/10724/6 "2010-08-28T04:40:26Z")

</div>

> [@chrisjj](#):
>
> ... Since my reply to Detlev, I find I can get away without that conditional:  
> **Format value "CJJTAGS": $if(%cjjtags%,%cjjtags%,$list(,:","|))  
> Remove fields except "CJJTAGS'**

The expression can be condensed a little bit:  
**Format value "CJJTAGS": $if2(%cjjtags%,$list(,:","|))  
Remove fields except "CJJTAGS'**

DD.20100828.0840.CEST

---

<div class="post-metadata">

### Author: ![realmassy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@realmassy](https://community.mp3tag.de/u/realmassy)
#### Post date: [November 25, 2010, 9:23pm UTC](https://community.mp3tag.de/t/conditional-action/10724/7 "2010-11-25T21:23:18Z")

</div>

Hi,  
how can I escape the comma inside a if function  
Basically I want to append the value of a tag if exist, prefixed with a comma, like this

 

%work%$if(%catalog no.%, **, %catalog no.%** ,)$if(%movement%,: %movement%,)$if(%tempo%,. %tempo%,)

 

Thanks!

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 25, 2010, 10:46pm UTC](https://community.mp3tag.de/t/conditional-action/10724/8 "2010-11-25T22:46:58Z")

</div>

> how can I escape the comma inside a if function

No way I know...

> Basically I want to append the value of a tag if exist, prefixed with a comma, like this

... but you can quote the string:

$if(%catalog no.%, **', %catalog no.%'** ,)

Check you really do want that initial space.

---

<div class="post-metadata">

### Author: ![realmassy](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/r/85e7bf/32.png) [@realmassy](https://community.mp3tag.de/u/realmassy)
#### Post date: [November 25, 2010, 11:00pm UTC](https://community.mp3tag.de/t/conditional-action/10724/9 "2010-11-25T23:00:48Z")

</div>

Thank chrisjj!  
That works perfectly, and this is now the song title:  
Piano Concerto No. 1 in C major, Op. 15: 1. Allegro con brio

And with the right if condition I will append the information only if I've tagged them  
Cheers!

---

<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:22pm UTC](https://community.mp3tag.de/t/conditional-action/10724/10 "2026-02-09T12:22:31Z")

</div>


