[Gambas-user] Sorting 2D arrays

John Rose john.aaron.rose at mailbox.org
Mon Aug 24 09:02:01 CEST 2020


I have 7 string arrays defined as follows:
Private aSeriesName As String[]
Private aEpisodeName As String[]
Private aEpisodeNumber As String[]
Private aEpisodeDescription As String[]
Private aEpisodeDatePublished As String[]
Private aEpisodeIdentifier As String[]
Private aSeriesDescription As String[]

Each array is populated in a loop from a similarly named string variable 
e.g. aSeriesName.Add(sSeriesName).

The ith element of each array are correspondent to each other (i.e. like 
a Relational Database row).

You could visualise the above (thus replacing the above arrays) as 
equivalent to a 2D array aData defined as 'Private[7, 1000] - I used 
1,000 as I couldn't work out how to have a dynamic 2D array where one 
'index' is fixed: can that be done?

Next problem with aData is there seems to be no Add method for a 2D 
array. Any ideas? Only idea that I've had is to specifically set an 
element of Data using a counter which is incremented by 1 for each 
element's value setting: something like aData[0, iCounter]=sSeriesName

I would like to sort aData using 2 of the 'fields' (SeriesName being 
major & EpisodeName being minor). I've noticed that there is a Sort 
method for a 1D array but not for a 2D array. Any ideas?

PS apologies if my explanation is not clear.



More information about the User mailing list