<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Here is the code I use all days(copy and paste directly from my
one code):</p>
<p>Public Function ColSort(col As Collection[], ColKey As String,
trie As Integer) As Collection[] <br>
Dim tmp_col As Collection[] = New Collection[col.count]<br>
Dim tmp_ar As String[] = New String[]<br>
<br>
For i As Integer = 0 To col.count - 1<br>
tmp_ar.Add(col[i][Colkey] & Chr(26) & i)<br>
Next<br>
<br>
tmp_ar.Sort(trie) <br>
For i = 0 To tmp_ar.count - 1<br>
tmp_col[i] = col[CInt(Split(tmp_ar[i], Chr(26), "",
True)[1])]<br>
Next<br>
Return tmp_col<br>
End </p>
<p>And it work !</p>
<p>And I don't understand why you are saying that collections in an
array shouldn't be sorted, it doesn't make sense ?</p>
<p>in an array of collections, there is an index for each
collection. If array is "ColArray"</p>
<p>We can retrieve the 5eme collection with: ColArray[5] <==5 is
the index and all array have an index.</p>
<p>Friendly</p>
<p>Olivier<br>
</p>
<div class="moz-cite-prefix">Le 21/01/2021 à 18:53, Jussi Lahtinen a
écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAFJMe7SeM1Ob1S4i=+D22k4J3DoQxafabXToZDq8kV6FgBWvMQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>I believe you have working code, but it definitely is NOT
the one you posted. It does not work.</div>
<div>Moreover, collections shouldn't be sorted. They are not
indexed.<br>
</div>
<div><br>
</div>
<div>Jussi<br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Jan 21, 2021 at 9:39
AM Olivier Coquet <<a href="mailto:ocoquet@3d-phenomen.fr"
moz-do-not-send="true">ocoquet@3d-phenomen.fr</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Sorry
my English is not very good,<br>
In fact, this function does not sort the array but the
collections it <br>
contains.<br>
In other words, if a collection array contains several
collections, the <br>
collections are not necessarily in order.<br>
For example:<br>
let's imagine an array that contains three collections
composed of three <br>
key/value pairs (name/surname/town).<br>
This function will sort the collections in alphabetical order
on any key.<br>
If you want to have the collections in the order of towns,
just specify <br>
"town" in the function call, and the collections will be
sorted on the <br>
key "town".<br>
As far as I know, no Gambas function does that, and yet it is
very <br>
convenient.<br>
<br>
Friendship<br>
Olivier<br>
<br>
Le 20/01/2021 à 19:57, Jussi Lahtinen a écrit :<br>
> No, I meant this; col[Colkey]. The Colkey as string.<br>
> And no, look more closely, what I said holds.<br>
><br>
> Jussi<br>
<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette"
rel="noreferrer" target="_blank" moz-do-not-send="true">http://gambaswiki.org/wiki/doc/netiquette</a>
]----<br>
</blockquote>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">
----[ <a class="moz-txt-link-freetext" href="http://gambaswiki.org/wiki/doc/netiquette">http://gambaswiki.org/wiki/doc/netiquette</a> ]----
</pre>
</blockquote>
</body>
</html>