# Set field = 2nd & 3rd characters of filename

**URL:** <https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564>\
**Category:** Support\
**Created:** [February 16, 2019, 9:01pm UTC](https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564 "2019-02-16T21:01:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![coyote](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/d6d6ee/32.png) [@coyote](https://community.mp3tag.de/u/coyote)\
**Post date:** [February 16, 2019, 9:01pm UTC](https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564/1 "2019-02-16T21:01:38Z")

</div>

How do I set the track field = the 2nd & 3rd characters of the filename?

I'm an mp3tab noob. I've got tracks where the filenames begin like

101  
102  
103  
...  
123  
124  
201  
202  
203  
...  
223  
224

where the first character is the Discnumber (I loaded that field simply highlighting the disc's rows and entering 1 [or 2] in the Discnumber field and selecting Save.)

I love mp3tag and look forward to learning more please!

Edit: Now I've got another fileset in which I need to just delete the first character in the Track field (because it already got set to a three digit number starting where the first character is the Discnumber).

I guess maybe what I really need is to know how to create custom actions; I've been googling and playing with it but haven't figured it out.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [February 16, 2019, 9:13pm UTC](https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564/2 "2019-02-16T21:13:09Z")

</div>

Import the whole number into TRACK.  
Then use an action of the type "Format value" for TRACK  
Format string: $num($mod(%track%,100),2)

---

<div class="post-metadata">

**Author:** ![coyote](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/d6d6ee/32.png) [@coyote](https://community.mp3tag.de/u/coyote)\
**Post date:** [February 17, 2019, 7:11am UTC](https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564/3 "2019-02-17T07:11:24Z")

</div>

Thank you very much for the help, ohrenkino! It worked perfectly of course.

Before I posted I read dozens of forum threads, and tested a simpler one (to 0-pad track). I'm a programmer, so I thought maybe it would just take a little time to learn the syntax, but wow, I'm very impressed by how powerful actions can be.

I'm VERY appreciative to ohrenkino and all the others who provide people with the code they need. Particularly because I couldn't google any primers on how to DIY. I feel kinda guilty about relying on ohrenkino's kindness, but very much appreciate all the precious time they saved me!

---

<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:** [January 21, 2025, 3:55pm UTC](https://community.mp3tag.de/t/set-field-2nd-3rd-characters-of-filename/44564/4 "2025-01-21T15:55:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
