# Guess values from catalog # to give result %album% \[%catalog #\]

**URL:** https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692
**Category:** Support
**Created:** [March 10, 2011, 5:14pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692 "2011-03-10T17:14:13Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 10, 2011, 5:14pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/1 "2011-03-10T17:14:13Z")

</div>

I need help in creating an action or script which will add to the album field with the contents of the catalog # field.

eg  
_album_: **Froggy EP**  
_Catalog #_: _ **DEFDIG1110** _

result  
_album_: **Froggy EP [DEFDIG1110]**  
_Catalog #_: _ **DEFDIG1110** _

I have tried using a similar action as below but the _album_ field keeps adding to itself every time I run the action eg  
_album_ 1st time: **Froggy EP [DEFDIG1110]**  
_album_ 2nd time: **Froggy EP [DEFDIG1110] [DEFDIG1110]**

I already have the action to fill the _catalog #_ from the _album_:

```
[#0]
T=7
F=%album%
1=%dummy% [%catalog #%]

```

Here it is in normal format:  
**Guess values**  
**Source format:** %album%  
**Guessing pattern:** %dummy% [%catalog #%]

This fills in the _catalog #_ from the _album_  
eg  
_album_: **Froggy EP [DEFDIG1110]**  
_Catalog #_: _BLANK FIELD_

result  
_album_: **Froggy EP [DEFDIG1110]**  
_Catalog #_: _ **DEFDIG1110** _

So I would greatly appreciate help with this, Thanks in advance.

---

<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: [March 10, 2011, 6:37pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/2 "2011-03-10T18:37:27Z")

</div>

> [@stevehero](#):
>
> ... will add to the album field ... the contents of the catalog # field. ...

You can use an action "Format value" and do not run it twice!  
_Actiontype 5:_ **Format value**  
_Field:_ **ALBUM**  
_Formatstring:_ **%ALBUM%'÷['%CATALOG÷#%']'**  
_Note: Replace each special ÷ character with one space character._

DD.20110310.2043.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 12, 2011, 1:51pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/3 "2011-03-12T13:51:04Z")

</div>

> [@DetlevD](#):
>
> You can use an action "Format value" and do not run it twice!  
> _Actiontype 5:_ **Format value**  
> _Field:_ **ALBUM**  
> _Formatstring:_ **%ALBUM%'÷['%CATALOG÷#%']'**  
> _Note: Replace each special ÷ character with one space character._
> 
> DD.20110310.2043.CET

thank you for that. But is it possible to do this as a reg exp to allow the action to run multiple times without adding to the album over and over again.

mainly beacuse I want to run this through my entire 10k library and some fields have the catalog # and some album fields have the format %album% [%catalog #] only.

Thanks DetlevD

---

<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: [March 12, 2011, 2:00pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/4 "2011-03-12T14:00:29Z")

</div>

> [@stevehero](#):
>
> ... is it possible to do this as a reg exp to allow the action to run multiple times without adding to the album over and over again.  
> mainly beacuse I want to run this through my entire 10k library and some fields have the catalog # and some album fields have the format %album% [%catalog #] only. ...

You describe a case of misuse.  
You can apply the Mp3tag Filter to prevent those accidents.  
Keep in mind, that files, which are not in view, will not be touched, so the run time will be faster.

DD.20110312.1606.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 12, 2011, 2:13pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/5 "2011-03-12T14:13:50Z")

</div>

> [@DetlevD](#):
>
> You describe a case of misuse.  
> You can apply the Mp3tag Filter to prevent those accidents.  
> Keep in mind, that files, which are not in view, will not be touched, so the run time will be faster.
> 
> DD.20110312.1606.CET

okay. Thanks again. I will use ur action but ill try to see if I could place this action inside the same one if the action is run twice that it deletes the 2nd closed brackets.  
eg.  
%album% [%catalog #%] [%catalog #%]  
result  
%album% [%catalog #%]

it would be a dirty fix but could just do the trick 🙂  
any suggestions. 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: [March 12, 2011, 2:38pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/6 "2011-03-12T14:38:47Z")

</div>

_Actiontype 5:_ **Format value**  
_Field:_ **ALBUM**  
_Formatstring:_ **$if($eql($right(%ALBUM%,$len('÷['%CATALOG÷#%']')),'÷['%CATALOG÷#%']'),%ALBUM%,%ALBUM%'÷['%CATALOG÷#%']')**  
_Note: Replace each special ÷ character with one space character._

DD.20110312.1645.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 12, 2011, 7:57pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/7 "2011-03-12T19:57:50Z")

</div>

Thanks, but it doesn't work. It keeps adding to the ablum field.  
Is it possible to instead delete everything after the 2nd last **]**  
**eg.**  
[catalog #**]** [catalog #]

---

<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: [March 12, 2011, 8:57pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/8 "2011-03-12T20:57:36Z")

</div>

> [@stevehero](#):
>
> Thanks, but it doesn't work. It keeps adding to the ablum field. ...

Well, I have checked the given action before publishing and did it again just now.  
The action works as designed.  
The action appends the catalog number to the ALBUM field only in the case, when there is no catalog number appended, otherwise it leaves the field content as is.

Maybe there is a spelling error in your transcript.

DD.20110312.2300.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 12, 2011, 11:26pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/9 "2011-03-12T23:26:39Z")

</div>

```
The action works as designed.

```

Thanks for your time and patience, I've added a few other things to make it work how I want. See below

**THIS WORKS**  **highlighted** are the values that move

[#0] Upper case for %catalog #%  
[#1] Transfer %album% **[%catalog #%]**  **to**  **%catalog #%**  **credit goes to DetlevD**  
[#2] Append **%catalog #%**  **to** %album% **[%catalog #%]**  **credit goes to DetlevD**  
[#3] Removes ÷[] (÷ represents a white space) ÷[] happens when there is no %album% **[%catalog #%]** or **%catalog #%**  
[#4] Removes [] added as I have trim leading space action above this action therefore deleting []

```
[#0]
T=1
F=CATALOG #
1=2
2=

[#1]
T=7
F=%album%
1=%dummy% [%catalog #%]

[#2]
T=5
F=ALBUM
1=$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']')

[#3]
T=2
F=ALBUM
1= []
2=
3=0|0

[#4]
T=2
F=ALBUM
1=[]
2=
3=0|0
```

---

<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: [March 13, 2011, 8:28am UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/10 "2011-03-13T08:28:54Z")

</div>

> [@stevehero](#):
>
> ... Thanks for your time and patience, I've added a few other things to make it work how I want. ...

You did not say that the fields ALBUM and/or CATALOG # could be _possibly not exist_ in your files, which you want to manipulate with the action script.

You can handle such erroneous case by using an appropriate Mp3tag Filter to not show such files, in order not to embed complex error handling into the scripting expressions.  
Sure, it is always a point of view and how someone organizes the work process.

If there is enough time and machine capacity, then someone can do the same error checking on each file, that means, repeatedly doing the same on 10k or more files, when maybe only a few files have really the need to be checked.  
It would be better to do a sort of pre processing in a first step, to divide the good ones from the bad ones, in order to prevent the good ones to be treated always as if they were bad ones.  
That is the job of the Mp3tag Filter.

The good message which I read from your action script is, that you know how to use the Mp3tag toolbox and how you can help yourself, to reach a self defined goal.

The following scripting expression has embedded the needed error checking.  
You can write the expression into one action "Format value" and run it for the field ALBUM.

**$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)**

Only if the fields ALBUM and CATALOG # exist, then the content from the field CATALOG # will be concatenated, using a space character, at the right edge of the content of the field ALBUM.  
If there exist already such a concatenation, then the field ALBUM will be left as is.  
If the content of the field CATALOG # has been changed in the meantime, then a new catalog number string will be appended to the existing content of the field ALBUM. This results to repeated concatenations.

Therefore it is recommended, before applying the scripting expression, to copy the original content of the field ALBUM to a backup field, for example ORIG\_ALBUM, and keep this backup field while the whole life time of the file.  
A backup field makes it possible to always restore the original condition. Possibly changes of the catalog number can take place without further problems.  
Using the value from field ORIG\_ALBUM together with the new catalog number will give the combined new value to put into the field ALBUM.

DD.20110313.1035.CET

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [March 13, 2011, 4:51pm UTC](https://community.mp3tag.de/t/guess-values-from-catalog-to-give-result-album-catalog/11692/11 "2011-03-13T16:51:43Z")

</div>

> [@DetlevD](#):
>
> The good message which I read from your action script is, that you know how to use the Mp3tag toolbox and how you can help yourself, to reach a self defined goal.  
> DD.20110313.1035.CET

Thank you, my may not have been the best way though but I wish I was as good as you though at this **stuff**.  
And sorry for not saying that some info was missing in the fields in the first place

I do use the filter but this is one of many actions I keep ticked all the time as I am slowly but surely going through my libray 🙂 my machine is an i7 CPU @ 3.2Ghz and 12GB RAM so it flys through them.

WORKS

```
The following scripting expression has embedded the needed error checking.
You can write the expression into one action "Format value" and run it for the field ALBUM.

$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)

```

Thank YOU so much

Much action file now looks like this ( **highlighted** are the values that move)  
[#0] Transfer **%album% [%catalog #%]** to **%catalog #%**  **credit goes to DetlevD**  
[#1] Append **%catalog #%** to **%album% [%catalog #%]** **(ONLY IF NOT THERE)**  **credit goes to DetlevD**

```
[#0]
T=7
F=%album%
1=%dummy% [%catalog #%]

[#1]
T=5
F=ALBUM
1=$if($and(%ALBUM%,%CATALOG #%),$if($eql($right(%ALBUM%,$len(' ['%CATALOG #%']')),' ['%CATALOG #%']'),%ALBUM%,%ALBUM%' ['%CATALOG #%']'),%ALBUM%)

```

---

<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/guess-values-from-catalog-to-give-result-album-catalog/11692/12 "2026-02-09T12:22:58Z")

</div>


