Format value question.

So I have about 500 Scarlatti sonatas; it's a pain in the ass to sort them, since they include catalog numbers at the end--i.e., K262, K56, K2.

What I'm wondering is, if there's a way to take the catalog numbers and make them all three digit; i.e., make K56 into K056 & K2 into K002?

$num($mid(STRING,$add($strrchr(STRING,K),1),10),3)

or in words
a number(
middle of

 (STRING,
    from position(
      add(
        first_time_char_from_right( in STRING is K)
        ,+1)
  ,max. 10chars long) <- fooled, could be done better

,formatted to 3 digits)

that's it. Should work, hopefully, for sorting, not for replacing your catalog numbers.
and don't forget to replace STRING which what you work with, eg. the catalognumber.

It didn't work, or I'm not doing it right.

The catalog number is the catalog number. It's at the end of the filename. What should I replace STRING with?

Lets get some things cleared first.
You want to SORT them, you want to RENAME them ???

Following hint.

  1. make use of the help, it's pretty good to help solving such issues.

  2. I'll give some hints, hopefully allowing you to solve it, since it you managed to solve the problem yourself with hints, it's your goal, and you'll be much more happy againt having simply copied a bunch of lines which do tell you nothing at all. :slight_smile:

If you did follow suggestion 1 you might already have been stumbled about placeholders such as %artist%, %_filename%, %title%, ....... and now pure guess you could replace 'STRING' with the one you think is the most sensefull one being used for a 'filename'. :slight_smile:

Some hints:

$num($mid(%_filename%,$add($strrchr(%_filename%,K),1),10),3)
is nothing but a number found right after the last 'K' being found expanded to 3-digits

$mid(%_filename%,$strrchr(%_filename%,K))
is the last 'K' found on it's own

both of these combined would for example if you an output in the form Kxxx no matter if the input was K1 K22 K555

$left(%_filename%,$strrchr(%_filename%,K))
gives you left part of something till within the last 'K' found, in other word everything apart from the numbers after the last 'K'

$left(%_filename%,$sub($strrchr(%_filename%,K),1))
gives you same as above but without the 'K'

My advice is as following: create a bunch of columns within mp3tag and put each of the examples into their value fields, and see what get's displayed.

need more help ?