<div dir="ltr"><div dir="ltr">Got it!<br><br>Thanks everybody for the answers and the advices. After 5 days of thick mind running, I've found a solution that is "perfect" for me.<br>It's only valid for strings and if your language has non-english characters you must adecuate the code to it but it works... And much faster than other solutions I've tried.<br>The trick is a function that "reverses" the characters of the descendent keys. So a = z, b=y,c=x, and so on.<br>Yes, I know is a little tricky, but it works.<br>Attached there is a example. It needs elaboration, but the idea is shown on it.<br></div></div><br><div class="gmail_quote"><div dir="ltr">El dom., 2 dic. 2018 a las 18:30, Charlie Ogier (<<a href="mailto:charlie@cogier.com">charlie@cogier.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
<div class="m_-8026716336316466069moz-cite-prefix">Hi Jorge,<br>
<br>
My solution: -<br>
<br>
Your data is "Country code", "Town" so: -<br>
<br>
<b><b>Data[0,0] = "US"</b> </b>and<b> <b>Data[1,0] = "New York"</b></b><br>
<b>Data[0,1] = "UK"</b> and <b>Data[1,1] = "London" <br>
</b><b><b>Etc<br>
<br>
</b></b>We want to sort by the "Town" (So we put it first)<br>
<br>
Create a <b>New String[]</b> with "Town" <separator>
"Country Code" <separator> "Town"<br>
<br>
<b>SortList.Add(Data[1,0] & "`" & Data[0,0] & "`"
Data[1,0])</b><b><br>
</b><b>SortList.Add(Data[1,1] & "`" & Data[0,1] & "`"
Data[1,1])</b><b><br>
</b>(use a loop)<br>
<br>
Sort the list<br>
<b>SortList.Sort()</b><br>
<br>
Now rebuild <b>Data</b> with the 2nd and 3rd items<br>
<br>
<b>For iLoop = 0 to ?</b><b><br>
</b><b> Data[iLoop,0] = Split(SortList[iLoop],"`")[1]</b><b> </b>'
"UK"<b><br>
</b><b> Data[iLoop,1] = Split(SortList[iLoop],"`")[2] </b>'
"London"<b><br>
</b><b>Next</b><br>
<br>
See example attached.<br>
<br>
Charlie<br>
<br>
<b><b> </b></b><br>
On 01/12/2018 18:13, Jorge Carrión wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">The problem:<br>
<br>
I need order a bi-dimensional array by several columns
following de user's criteria.<br>
<br>
It is relatively simple to order a two-dimensional array for a
column, not long ago we saw several solutions in this mail
list, but what I need now is to sort by several columns and
that each of them can be ascending or descending.<br>
<br>
I confess that I have been stuck with the subject for four
days, that I have believed more than once that I had solved it
and that in the end I have given up doing it alone. Does
anyone have any idea how to approach the issue before it
drives me crazy?<br>
<br>
There is a "tricky" solution: grab your two-dimensional array,
create with it a sqlite base and let the sqlite engine solve
the issue with an SQL statement ... but this is not the case
(it would force the project to link with the modules database
and it's not always convenient)</div>
<div dir="ltr"><br>
</div>
<div>Waiting for the better minds than mine advice...</div>
<div><br>
</div>
<div>Best Regards<br>
</div>
</div>
<br>
<fieldset class="m_-8026716336316466069mimeAttachmentHeader"></fieldset>
<pre class="m_-8026716336316466069moz-quote-pre">
----[ Gambas mailing-list is hosted by <a class="m_-8026716336316466069moz-txt-link-freetext" href="https://www.hostsharing.net" target="_blank">https://www.hostsharing.net</a> ]----
</pre>
</blockquote>
<br>
</div>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>