Re: [Gambas-user] Sort multidimensional array?

2017-02-09 Thread Charlie
I played with this problem and came up with the attached. Hope it helps sort_second_array.tar - Check out www.gambas.one -- View this message in context: http://gambas.8142.n7.nabble.com/Sort-multidimensional-array-tp58

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread Jussi Lahtinen
Not sure what you are trying to do, but you just keep on adding things to array B, and then adding the same reference of that array to array A. Maybe you instead wanted this: Dim A As New Variant[] Dim B As Variant[] Dim i, j As Integer For i = 0 To 9 B = New Variant[] For j = 0 T

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread novae_lithic
Note the typo, it should read "B.Add(i)" ... the problem persists either way 7. Feb 2017 20:28 by ml-node+s8142n58416...@n7.nabble.com: > Thank you very much, Tobi, for the insights, and the link to the "GridView – > Sortierung der Daten" > > Based on that I tried to implement the following,

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread novae_lithic
Thank you Gianluigi - your DynamicMatrixExmaple was one of the first I explored when starting with Gambas - it's a very useful learning aid. cheers. -- View this message in context: http://gambas.8142.n7.nabble.com/Sort-multidimensional-array-tp58403p58420.html Sent from the gambas-user mailin

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread novae_lithic
Hi Matti, Thank you for your response. I had been considering a similar approach, as it allows me to leave out the columns I wouldn't need. So it's great to see your robust implementation of it. cheers. -- View this message in context: http://gambas.8142.n7.nabble.com/Sort-multidimensional-ar

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread novae_lithic
Thank you very much, Tobi, for the insights, and the link to the "GridView – Sortierung der Daten" Based on that I tried to implement the following, to test the concept. But the values for the rows (B) are the same in all cases (always 0 ...) as if the variable "i" wasn't incrementing in the loop

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread Rolf-Werner Eilert
Hi Matti, I don't find your method so dirty - I have used it a lot of times myself. And I use it in table-like arrays with more than 2 columns, all as strings. However, I use a character which does not appear in normal strings, like TAB (chr$(9)) or chr$(6). To pack and unpack a single line,

Re: [Gambas-user] Sort multidimensional array?

2017-02-07 Thread Gianluigi
Hi Richard, See my project DynamicMatrixExample, in Examples of Gambas Software Farm Regards Gianluigi 2017-02-07 0:30 GMT+01:00 Tobias Boege : > On Mon, 06 Feb 2017, Riccardo wrote: > > Hi, > > > > Is it possible to use the array.sort() method on a two-dimensional array? > > > > > > > > > > >

Re: [Gambas-user] Sort multidimensional array?

2017-02-06 Thread Tobias Boege
On Mon, 06 Feb 2017, Riccardo wrote: > Hi, > > Is it possible to use the array.sort() method on a two-dimensional array? > > > >   > > >     Public arr_Response As New String[][] > > > > > > > Specifically, I'd like to sort the entire array based on the contents of the > second column

Re: [Gambas-user] Sort multidimensional array?

2017-02-06 Thread Matti
Hi Riccardo, this is a question I had long years ago. At this time it was not possible. As I remember, I used a dirty workaround, reducing the two-dimensionsional array by inserting a "/" to a one-dimensional array, sorting it and removing the "/" later. Depends on what array you have to sort.

[Gambas-user] Sort multidimensional array?

2017-02-06 Thread Riccardo
Hi, Is it possible to use the array.sort() method on a two-dimensional array?   >     Public arr_Response As New String[][] > Specifically, I'd like to sort the entire array based on the contents of the second column something like: arr_Response[][1].sort() ...  cheers. -