# Format value- the skipping of

**URL:** <https://community.mp3tag.de/t/format-value-the-skipping-of/16705>\
**Category:** Support\
**Created:** [March 17, 2015, 6:51pm UTC](https://community.mp3tag.de/t/format-value-the-skipping-of/16705 "2015-03-17T18:51:15Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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 19, 2015, 4:46pm UTC](https://community.mp3tag.de/t/format-value-the-skipping-of/16705/8 "2015-03-19T16:46:38Z")

</div>

> [@zerow](#):
>
> ... And so here is my whole automated TRACK and DISCNUMBER numbering process; derived from a FILENAME with a 000 / 00 track format at the beginning of it ...

Well, I have tried to understand what there is going on, ... and I have given up.  
But I wrote down a worksheet.

1. Example Filenames ...

1 - filename.001.mp3 No Disk Nr  
10 - filename.002.mp3 No Disk Nr  
100 - filename.003.mp3 No Track Nr  
1000 - filename.004.mp3 No Track Nr  
0001 - filename.005.mp3 No Disk Nr  
001 - filename.006.mp3 No Disk Nr  
01 - filename.007.mp3 No Disk Nr  
011 - filename.008.mp3 No Disk Nr  
101 - filename.009.mp3 Disk Nr and Track Nr exist  
0101 - filename.010.mp3 Disk Nr and Track Nr exist

Number format for Discnumber and Track can be or should be ...  
DDTT  
DD = Disk Nr  
TT = Track Nr

1. Save existing content from DISCNUMBER and TRACK ...  
for possible later use to helper tag-fields ...

ORIG\_DISCNUMBER \<== `$if2(%ORIG_DISCNUMBER%,%DISCNUMBER%)`  
ORIG\_TRACK \<== `$if2(%ORIG_TRACK%,%TRACK%)`

1. Prepare helper tag-field for Discnumber and Track ...

Get one to four leading digits from filename into helper tag-field, ...  
if there is no such number format, then set helper tag-field to '0000' ...  
TEMP\_DDTT \<== $if($eql($regexp(%\_filename%,'^(\d{1,4})(\D.+)?$',),),

`$regexp(%_filename%,'^(\d{1,4})(\D.+)?$','$1'),'0000')`

Make all leading number strings the same format, ...  
by right adjust the given numbers with leading zeroes ...  
TEMP\_DDTT \<== `$right('0000'%TEMP_DDTT%,4)`

Possible DDTT cases ...  
0000 No Disk Nr and no Track Nr  
0001 No Disk Nr  
0100 No Track Nr  
0101 Disk Nr and Track Nr exist

1. Split TEMP\_DDTT into Discnumber and Track, fill helper tag-fields ...

... with leading zero ...  
TEMP\_DISCNUMBER \<== `$left(%TEMP_DDTT%,2)`  
TEMP\_TRACK \<== `$right(%TEMP_DDTT%,2)`

... or without leading zero ...  
TEMP\_DISCNUMBER \<== `$div(%TEMP_DDTT%,100)`  
TEMP\_TRACK \<== `$mod(%TEMP_DDTT%,100)`

1. Fill standard tag-fields ...

DISCNUMBER \<== `$ifgreater(%TEMP_DISCNUMBER%,0,%TEMP_DISCNUMBER%,)`  
TRACK \<== `$ifgreater(%TEMP_TRACK%,0,%TEMP_TRACK%,)`

1. Remove helper tag-fields ...  
... use action "Remove fields"  
... or this way ...  
TEMP\_DDTT \<== $char(0)  
TEMP\_DISCNUMBER \<== $char(0)  
TEMP\_TRACK \<== $char(0)

2. Probably add a step ...  
for comparing the new values with the original values ...  
and decide what to do ...  
DISCNUMBER ??? ORIG\_DISCNUMBER  
TRACK ??? ORIG\_TRACK

3. Probably remove original values ...  
... use action "Remove fields"  
... or this way ...  
ORIG\_DISCNUMBER \<== $char(0)  
ORIG\_TRACK \<== $char(0)    
[Format\_DISCNUMBER\_Set\_DISCNUMBER\_TRACK\_from\_\_DDTT\_Filename\_.mta](https://community.mp3tag.de/uploads/default/original/2X/d/d50aa711f332f5fefd0550b8e2f140d193a93b25.mta) (640 Bytes)  
DD.20150319.1846.CET, DD.20150320.1220.CET

[Format\_DISCNUMBER\_Set\_DISCNUMBER\_TRACK\_from\_\_DDTT\_Filename\_.mta](https://community.mp3tag.de/uploads/default/original/2X/d/d50aa711f332f5fefd0550b8e2f140d193a93b25.mta) (640 Bytes)

---

_[View the full topic](https://community.mp3tag.de/t/format-value-the-skipping-of/16705)._
