Sort by file name then by track number

I recently reinstalled my OS and software, now MP3Tag isn't working the way it used to.

I am used to clicking on one column header, such as file name or artist, then clicking on a second column header--usually track number. This would, for example, sort everything by artist first, then arrange tracks by each artist in order while still maintaining the grouping of the first filter. It's worked like that for as long as I can remember.

Now it's not working. When I click on my second column, I lose whatever sorting I just processed. I've always been able to apply one filter and then another.

Can someone tell me what I've done or what I need to check?

OMG. I just noticed another weird thing: The Album column is right-justified, instead of left-justified, and it's the only one like that. Can I fix this, too?

I hope so: check in the Context Menu "Colums" for the title column if the box "numerical" is ticked. If so: unselect.

Sorting: sort the subordinate column first, then the superior.
So: if you want to have all tracks sorted ascending and then by artist, click the columns in that sequence.
(This would lead to a sorting that mixes up all the albums ... point?)
The general rule is: the last sorting wins.

I tried it that way, but it doesn't work, either. There is no subordinate/superior sorting going on--not with the Filename field, anyway (which is the one I always used).

If I click track to order them numerically, then click Artist, nothing changes at all. The only thing that happens is that the little arrow next to Artist will flip, but the list below doesn't change. If I then go on and click the Album header, the tracks will sort in numeric order by Artist and by Album.

I'm certain it didn't work this way before. Maybe this is an "update?"

I'm used to being able to sort using Track and Filename.

(superior and subordinate described the sequence not any kind of settable hierarchy - in effect MP3tag always sorts the last selected unique field)
Which brings me to an explanation:
If you sort by filename then you sort by a criteria that is already unique and therefore leads to a defined sorting order. There are not duplicates.
If you sort by number, then all numbers are arranged sequentially: first all the ones, then the twos.
If you now sort by Artist it does not make any difference as the artist is always the same, I take it. So MP3tag looks up the list, Takes the first record from that artist from the list, then the second and so on. As you have already sorted by a different criteria, the list LOOKS the same, but is in fact sorted by artist.
Now: if you sort a list with various albums in the sequence "First track, then album" the same mechanism applies:
MP3tag goes through the list of albums and puts the first tracknumber of the first album in first place, then puts the second tracknumber of the first album in second place and so on.
THis leads to a sorted list where all albums are sorted alphabetically and the sequence inside the album is determined by the sequence of the record from the previous list.

Back to the filename: as this is a unique sort criteria, the sequence of the previous list is irrelevant.

The column dialog of the Mp3tag list view allows to enter a user defined sort criterium per column.

Column Name: Album
Column Value: $meta_sep(album,'\\')
Column Field: %album%
Column Sort By: %album%%discnumber%%track%%title%
Column Numeric: no

This will reduce the steps of sorting other columns in order to get the sorting by wish to one click (maybe two clicks for descending sorting).

Read about how to customize columns in the manual.


Be aware that this sorting expression is "quick and dirty", and does not sort correct in all cases.
In order to get a better sorting result you need to do some column sizing like ...
Column Sort By: $left(%album%$repeat(' ',50),50)$right($repeat(' ',3)%discnumber%,3)$right($repeat(' ',7)%track%,7)$left(%title%$repeat(' ',100),100)


I pointed out above, that a Column Sort expression of ...
... might not sort correct in all cases.

I proposed a fixed size Column Sort expression, which provides a better guarantee to do a reliable sorting. But the expression for itself looks complicated, and the prediction of the fixed size column width might be predicted to fail for one special case some day and it costs computer memory resources.

It might be possible to permit dynamic length per tag-field, when the individual tag-fields are delimited by a special character, respectively by a special character sequence, which is impossible to occur in the tag-field content.

Something like this should be coded ...
Column Sort By: %album%'-|?|-'%discnumber%'/|/'%track%'++*'%title%
... or this ...
Column Sort By: %album%$char(7)%discnumber%$char(7)%track%$char(7)%title%


I edit the "Sort by" field for a given column using parameters as described. Are those parameters detailed all laid out in the Help documentation? Sure would be nice to click once and sort everything.

Now, any idea why the Artist field is right-justified, instead of left-justified like everything else?

Have you tried the hint in post #3?
"I hope so: check in the Context Menu "Colums" for the title column if the box "numerical" is ticked. If so: unselect."

Yeah, that was it--numeric was checked for the Artist column. Thanks.

I inserted %artist%%album%%track% into the Artist "Sort By" field and now everything is great. I can just click that one field and have large groups of assorted MP3s organized the way I need.

What an awesome program!

Thanks for all the help.

%artist% Artist
%album% Album
%genre% Genre
%title% Title
%track% Track-Number
%year% Year

My new sort column script is this:

Sort by: %artist% - %year% - $if2(%ALBUMSORTORDER%,%album%) - %track%


This kind of sorting may be suitable for your personal approach.
For me, it is not suitable as putting the %year% tag so far in front will lead to strange results if you have artists with antologies (like the Beatles and their blue and red album and the album "1") and you have assigned the original release year to the tracks.
In this case these albums are torn apart if you have organized your folders that you first see the artist, then the albums.
Filling the %year% with the album release date and %origyear% with the song release date is not the best way as a lot of players do not read the %origyear% tag.

Good point.

I use the following special sorting expressions in my columns.ini.
But I have never checked them for all possible circumstances.






True. My method wouldn't work for you.

I've always dealt with compilation or "greatest hits" albums this way:

If a track on the compilation was previously released on a prior album or single, I list the track only as part of the original album or single with that album's or single's original release date in the "year" tag.

Only if a track on the compilation album has never previously been released or is a new mix do I use the compilation album's name and date in the file's tags.

My collection also includes the Beatles Red and Blue albums and I broke them down this way.

In rare circumstances I do keep a compilation album together (For example, Pink Floyd's "Echoes"; which was creatively arranged as two entire album sides which should each be listened to in one sitting, and who's tracks were sometimes remixed and edited so that they segued seamlessly together, one into the next, much like Floyd's studio albums did) ... and in such case I always use the date of album release.

Long story short: For me, "Year" tag is always the year that the "Album" tag was released. Not the date the track was recorded or anything else.

Noticed you included the "Disc Number" tag as well. Makes sense! I use to always included the disc number as part of the album title tag (ex: "Echoes [Disc 1]") and simply erased all the disc number tags; but have just realized it makes more sense to use the disc number tag now that all my iDevices support it! I'm going back and updating all my multi-disc sets as I write this!

Therefor, my new "Sort by" sequence is this:

Sort by:

$if2(%artistsort%,%artist%) - %year% - $if2(%albumsort%,%album%) - %discnumber% - %track%

[Edited a lot May 1, 2011 as I've seen the light on using the Disc Number tag, and version 2.47!]

sorry @ohrenkino about reviving all these old threads but I cant get it to work or maybe dont understand it properly.

when I open mp3tag and the sort by track number and then path, I get what I want (basically sorted by artist then album and within the album by track).

but I cant get this to stick, as soon as I close and open again, this sorting scheme reverts back to something else.

how to I save/make mp3tag remember the sort-by order?

If you have more complex sort orders, it may be a good idea to fill the "Sort by" property in the column definition.
To be honest: as filenames have to be unique anyway, I have my problems to see how a previous sorting by track should be beneficial.
A better use-case is if you have the same data in ALBUM but you want to have it sorted by TRACK then first sort by TRACK and then by ALBUM.
And if you want to make it stick, enter
in "Sort by" for the column with ALBUM
If you then click on the column header of that column, the contents gets sorted by the criteria in "Sort by".

1 Like

thanks mate. I’ll try this on the weekend!

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