# Populate a field if another tag is 1 - otherwise do something else

**URL:** https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134
**Category:** General Discussion
**Created:** [October 23, 2013, 3:55pm UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134 "2013-10-23T15:55:06Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sjw211](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@sjw211](https://community.mp3tag.de/u/sjw211)
#### Post date: [October 23, 2013, 3:55pm UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/1 "2013-10-23T15:55:06Z")

</div>

Hi all, hope you can help...  
I want to populate the Album Artist field to be 'Various' IF the COMPILATION tag is 1 - otherwise clear the COMPILATION tag and copy the Artist tag to the Album Artist tag.  
What's the best way to do this?

---

<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: [October 23, 2013, 5:44pm UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/2 "2013-10-23T17:44:07Z")

</div>

> [@Me!](#):
>
> ... I want to populate the Album Artist field to be 'Various' IF the COMPILATION tag is 1 - otherwise clear the COMPILATION tag and copy the Artist tag to the Album Artist tag.What's the best way to do this?

You can create two actions of type "Format value".

 **%ALBUMARTIST% \<== $if($eql(%COMPILATION%,'1'),'Various',%ARTIST%) %COMPILATION% \<== $if($eql(%COMPILATION%,'1'),%COMPILATION%,%DUMMY%)**

... or ...

**%COMPILATION% \<== $if($eql(%COMPILATION%,'1'),%COMPILATION%,)**

DD.20131023.2148.CEST

---

<div class="post-metadata">

### Author: ![sjw211](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@sjw211](https://community.mp3tag.de/u/sjw211)
#### Post date: [October 23, 2013, 8:39pm UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/3 "2013-10-23T20:39:21Z")

</div>

> [@DetlevD](#):
>
> You can create two actions of type "Format value".
> 
> **%ALBUMARTIST% \<== $if($eql(%COMPILATION%,'1'),'Various',%ARTIST%) %COMPILATION% \<== $if($eql(%COMPILATION%,'1'),%COMPILATION%,%DUMMY%)**
> 
> DD.20131023.2148.CEST

Detlev, that is perfect - many thanks!!  
I created an action and in the first box I selected ALBUMARTIST and pasted $if($eql(%COMPILATION%,'1'),'Various',%ARTIST%) into the 'format string' box. I then added a second and selected COMPILATION and pasted $if($eql(%COMPILATION%,'1'),%COMPILATION%,%DUMMY%) into the 'format string' box.  
I assume that is what you meant - two separate 'commands' in one action.?.

When I list tracks, for some tags I can type directly into the box within the main listing. When I add COMPILATION to the tag list, if I want to change it, I can't just type the entry and have to go to the left hand side and fill it in. Is there a way I can just type into this tag in the 'list' view of the main window?

Again though, MANY thanks!

---

<div class="post-metadata">

### Author: ![poster](https://community.mp3tag.de/user_avatar/community.mp3tag.de/poster/32/4881_2.png) [@poster](https://community.mp3tag.de/u/poster)
#### Post date: [October 24, 2013, 3:49am UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/4 "2013-10-24T03:49:00Z")

</div>

> [@Me!](#):
>
> When I list tracks, for some tags I can type directly into the box within the main listing. When I add COMPILATION to the tag list, if I want to change it, I can't just type the entry and have to go to the left hand side and fill it in. Is there a way I can just type into this tag in the 'list' view of the main window?

Have a look at the help section for columns:  
[https://docs.mp3tag.de/customization/file-list](https://docs.mp3tag.de/customization/file-list)  
and there at the explanation for "Field".

You have to fill in "Value" **and**"Field"

---

<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: [October 24, 2013, 5:40am UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/5 "2013-10-24T05:40:37Z")

</div>

> [@Me!](#):
>
> Detlev, that is perfect - many thanks!! ...  
> I assume that is what you meant - two separate 'commands' in one action.?.
> 
> When I list tracks, for some tags I can type directly into the box within the main listing. When I add COMPILATION to the tag list, if I want to change it, I can't just type the entry and have to go to the left hand side and fill it in. Is there a way I can just type into this tag in the 'list' view of the main window? ...

Actually, I should have said:  
Do create one action group with two actions of type "Format value",  
give this action group a meaningful name,  
so you can invoke this "action script" by its name from the menu.

Mp3tags allows to create an user defined column in the main spread list.  
Do a secondary mouse click on the column header of the main spread list, then the "Column" dialog will be opened.  
Fill in a meaningful column header name: Compilation  
The value, which should be displayed, is: %COMPILATION%  
The tag field, which should be set by changes in this column, is: %COMPILATION%

DD.20131024.0940.CEST

---

<div class="post-metadata">

### Author: ![sjw211](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/a87d85/32.png) [@sjw211](https://community.mp3tag.de/u/sjw211)
#### Post date: [October 24, 2013, 8:23am UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/6 "2013-10-24T08:23:12Z")

</div>

Thanks everybody!  
I went to View - Customise columns. I selected the Compilation tag that I had previously added and filled in the 'field' box with %compilation%. I can now type directly into the right hand side tag too. 🙂

I wish I understood how the first script works.  
Is it:  
IF compilation is 1 then make ALBUMARTIST 'Various', otherwise make it ARTIST ?

For the second line, is that the one dealing with changing the COMPILATION tag if required?  
i.e. IF COMPILATION is 1 then copy COMPILATION to COMPILATION (i.e. keep it!), otherwise make it %DUMMY% (which I assume means clear it.)

---

<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: [October 25, 2013, 6:08am UTC](https://community.mp3tag.de/t/populate-a-field-if-another-tag-is-1-otherwise-do-something-else/15134/7 "2013-10-25T06:08:56Z")

</div>

> [@Me!](#):
>
> Thanks everybody! ... I wish I understood how the first script works. ...

You have understood it correctly.

DD.20131025.1009.CEST
