Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Aggregate functions (Read 1635 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Aggregate functions

Is there a title formatting for aggregate functions? I would like to define a sort order which sorts albums according to the date of the oldest track on the album.
I'm late

Aggregate functions

Reply #1
edit>sort>sort by...

assuming the date tag of each track is correctly set, something like this might do....

Code: [Select]
%album artist%|%album%|%date%|%tracknumber%|%title%


the tracknumber/title is on the end to sort tracks with the same date in that order.

edit: upon re-reading the OP again, if you want to sort a playlist of multiple albums by the oldest track on the album and ignoring the date of the rest of the tracks then this is not possible. all title formatting is evaluated on a per track basis.

Aggregate functions

Reply #2
(Assuming you are saying you want to reverse the sort order.)

A good starting point would be $sub(9999,%date%). The same idea could be expanded to YYYY-MM-DD and other formats as well, but that would require more coding.

If you have query syntax available, SORT DESCENDING BY %date% works too.

Aggregate functions

Reply #3
edit: upon re-reading the OP again, if you want to sort a playlist of multiple albums by the oldest track on the album and ignoring the date of the rest of the tracks then this is not possible. all title formatting is evaluated on a per track basis.


Yep, that's my aim. More generally I'd like to find a way to make calculations and manipulations on the tags of a set of files defined by a given value (in this case the defining value is the album).
I'm late

Aggregate functions

Reply #4
Such aggregate functions are not available in title formatting scripts. Possible work-arounds are to create additional tags which contain the result of an aggregate function or to use a more powerful scripting language like JScript in the WSH panel plugin.

Aggregate functions

Reply #5
...use a more powerful scripting language like JScript in the WSH panel plugin.


That would be great, but even though I have some serious programming experience with other languages, I don't seem to get to the bottom of the WSH. I had a look at the two threads on the WSH panel, but they were no help. Where should I begin?
I'm late