convert multi disc album track numbers

I wanted to convert track numbers from multi disc albums to the following format (d=disc, track=track)

D(0)T

e.g. 101,102..201,202...1001,1002..1010, etc.

While some players understand the disc number field for sorting, some need this trick to correctly sort these albums.

As some of my box sets have >150 discs I would prefer this to be done automatically.

I created a format value action.
Field: TRACK
Format String: $add($mul(%DISCNUMBER%,100),%TRACK%)

One drawback is that the original track number is not stored anymore so repetitive application of this action will create weird results (which can easily be corrected by a function which does exactly the oposite.

If you create an action group that performs not just one step but first gets the pure TRACK number and then merges it with the discnumber, you stay clean:

Format value for TRACK
Format string: $mod(%track%,1000)

Format value for TRACK
Format string: $mod(%track%,100)

To merge
Format String: $add($mul(%DISCNUMBER%,100),%TRACK%)
(as you already wrote)

If you want to remember the old values, then you can save them in your own tag fields, for example:
TRACK_ORIGINAL <== $if2(%TRACK_ORIGINAL%,%TRACK%)
DISC_ORIGINAL <== $if2(%DISC_ORIGINAL%,%DISCNUMBER%)

When dealing with numbers, it is often a question of whether the following sorting should take place numerically or alphabetically.
For safety reasons, the alphabetical sorting can be used by preparing the numerical values, e. g. ...
two digits: 1 -> 01, 2 -> 02, etc.
three digits: 1 -> 001, 2 -> 002, etc.

Some automation is obtained with the following formatstring ...
after selecting the files to be numbered ... ... apply the formatstring ...

TRACK <== $num(%_counter%,$len(%_total_files%))'/'$num(%_total_files%,$len(%_total_files%))

... or without the slash divider ...
TRACK <== $num(%_counter%,$len(%_total_files%))$num(%_total_files%,$len(%_total_files%))

DD.20171017.1031.CEST