# Suggestion - Sort function for multivalue tag-fields

**URL:** https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743
**Category:** General Discussion
**Created:** [August 30, 2010, 4:49am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743 "2010-08-30T04:49:52Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [August 30, 2010, 4:49am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/1 "2010-08-30T04:49:52Z")

</div>

I think that Mp3tag needs a sort function (ascending, descending) for sorting a multivalue meta tag-field.

DD.20100830.0849.CEST

---

<div class="post-metadata">

### Author: ![egd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@egd](https://community.mp3tag.de/u/egd)
#### Post date: [September 6, 2010, 2:40pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/2 "2010-09-06T14:40:45Z")

</div>

another useful suggestion

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [September 21, 2010, 7:38am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/3 "2010-09-21T07:38:14Z")

</div>

How about not limiting it to multivalue fields?

$stringsort(string,delimeter)

$stringsort('b, a, c',', ') -\> a, b, c

$stringsort($meta\_sep(artist,\\),\\) -\> a\\b\\c

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [September 21, 2010, 10:23am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/4 "2010-09-21T10:23:20Z")

</div>

> [@dano](#):
>
> How about not limiting it to multivalue fields? ...

Yes.

Using a delimiter string opens much more usability than a single delimiter character.  
The splitting of the given string can simply be realized like it is done by the .NET Framework Class Library Regex.Split Method (String, String).

I would like to see a third optional parameter, which indicates how to sort, ascending or descending.

$StringSort(StringBase,StringDelimiter[,SortDirection])

The parameter "SortDirection" can be an integer of {0,1} with "0=sort ascending" as the default sorting behaviour.

DD.20100921.1423.CEST

---

<div class="post-metadata">

### Author: ![chrizoo](https://community.mp3tag.de/user_avatar/community.mp3tag.de/chrizoo/32/233_2.png) [@chrizoo](https://community.mp3tag.de/u/chrizoo)
#### Post date: [July 25, 2011, 11:16am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/5 "2011-07-25T11:16:24Z")

</div>

Very useful function!

crosslinking to --\> [German feature suggestion thread **$sort(x,sep)**](https://community.mp3tag.de/t/12319/1)  
because - despite research - I couldn't find this thread here before posting the same idea.

Differences:

- I named the function **$sort** instead of $stringsort for bevity.
- I named the 3rd param (i.e. sortdirection) **a-z** and **z-a** instead of 0/1 for better human readability and user friendliness.
- With **$sortz** or **$zsort** I suggested a possible alternative for inverse sorting in order to keep $sort a 2 param function.

---

<div class="post-metadata">

### Author: ![HansBKK](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/h/5daacb/32.png) [@HansBKK](https://community.mp3tag.de/u/HansBKK)
#### Post date: [September 2, 2012, 1:15pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/6 "2012-09-02T13:15:13Z")

</div>

+1

Practical example - I periodically run my albums against MusicBrainz to see if their records have got anything useful added. By "backing up" the main fields that differ from what I want after such a run, and then "restoring" them just before the next one, the "remove perfect matches" plugin leaves only a list with updates.

However the sort ordering randomness is preventing the perfect matching, easy enough to visually scan when it's just a few dozen albums, but when the whole collection's being batched makes the process pretty painful.

---

<div class="post-metadata">

### Author: ![egd](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/3da27b/32.png) [@egd](https://community.mp3tag.de/u/egd)
#### Post date: [September 3, 2012, 4:20am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/7 "2012-09-03T04:20:08Z")

</div>

doing any multi-album processing using tag sources in mp3tag is extremely painful because there's no real way of automating it so even if semi-automated via auto-it your ass is still glued to the chair album by album.

---

<div class="post-metadata">

### Author: ![HansBKK](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/h/5daacb/32.png) [@HansBKK](https://community.mp3tag.de/u/HansBKK)
#### Post date: [September 3, 2012, 5:53am UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/8 "2012-09-03T05:53:18Z")

</div>

> [@egd](#):
>
> doing any multi-album processing using tag sources in mp3tag is extremely painful because there's no real way of automating it so even if semi-automated via auto-it your ass is still glued to the chair album by album.

Not sure if you're addressing me or just complaining generally. If the former, I'm using Picard, which seems pretty quick so far, especially when most of the albums being tested do match perfectly and can be made to disappear with a single click using the plugin I mentioned.

Note in this case I've discovered that converting my multi-valued tags from single-field delimited to true multi-field solves that particular problem, as Picard apparently can auto-sort for comparison purposes for the latter but not the former.

So I've created a "convert to multi" Action group that lists all my (potentially) multi-valued fields and does this:

```
$regexp(%contentgroup%,'\s*[;]\s*','\\\\')

```

and a "convert to single" one that does this:

```
$meta_sep(CONTENTGROUP,; )

```

and Bob's your uncle.

Anyone know of a way to call one Action group from another?

---

<div class="post-metadata">

### Author: ![aax](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/a/edb3f5/32.png) [@aax](https://community.mp3tag.de/u/aax)
#### Post date: [September 4, 2012, 6:53pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/9 "2012-09-04T18:53:09Z")

</div>

That kind of sorting would be really helpful.

---

<div class="post-metadata">

### Author: ![Helio\_SS](https://community.mp3tag.de/user_avatar/community.mp3tag.de/helio_ss/32/22287_2.png) [@Helio\_SS](https://community.mp3tag.de/u/Helio_SS)
#### Post date: [May 2, 2026, 12:28pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/10 "2026-05-02T12:28:16Z")

</div>

This one fits my use case of trying to harmonize the composer's data

---

<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: [May 2, 2026, 12:31pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/11 "2026-05-02T12:31:37Z")

</div>

Meanwhile there is a scripting function to sort:  
`$sort(x,y)` sorts segments of a string x based on a specified delimiter y.  
See also

> **[String Functions - Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/#string-functions)**
>
> Mp3tag offers various built-in scripting functions, which can be used at various places in the program. | Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

---

<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: [May 9, 2026, 12:31pm UTC](https://community.mp3tag.de/t/suggestion-sort-function-for-multivalue-tag-fields/10743/12 "2026-05-09T12:31:56Z")

</div>

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