<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<div class="moz-cite-prefix">On 24/08/2020 16:03,
<a class="moz-txt-link-abbreviated" href="mailto:user-request@lists.gambas-basic.org">user-request@lists.gambas-basic.org</a> wrote:<br>
</div>
<blockquote type="cite"
cite="mid:mailman.0.1598281382.7771.user@lists.gambas-basic.org">
<pre class="moz-quote-pre" wrap="">Also you have this thing interesting :
Public MyValue as String Use $MyValue
That replace your stuff
Public MyValue as String
Private $MyValue
Public Sub MyValue_Read()
Return $MyValue
End
Public Sub MyValue_Write(Value as String)
$MyValue = Value
End
the same in One only Line, But in the case of a bidimentionnal array
I'm not sur it is so mandatory.
Le lun. 24 août 2020 à 14:52, Gianluigi <a class="moz-txt-link-rfc2396E" href="mailto:bagonergi@gmail.com" moz-do-not-send="true"><bagonergi@gmail.com></a> a écrit :
</pre>
<blockquote type="cite" style="color: #000000;">
<pre class="moz-quote-pre" wrap="">
Il giorno lun 24 ago 2020 alle ore 14:34 Fabien Bodard <a class="moz-txt-link-rfc2396E" href="mailto:gambas.fr@gmail.com" moz-do-not-send="true"><gambas.fr@gmail.com></a> ha scritto:
</pre>
<blockquote type="cite" style="color: #000000;">
<pre class="moz-quote-pre" wrap="">Arf..
make a class
'Class CEpisode
Static Public SortMode As Integer
Public Enum bySeriesName, byEpisodeName, byEpisodeNumber '... etc
Public SeriesName As String
Public EpisodeName As String
Public EpisodeNumber As Integer
Public EpisodeDescription As String
Public EpisodeDatePublished As String
Public EpisodeIdentifier As String
Public SeriesDescription As String
Public Sub _Compare(Other As CEpisode) As Integer
Select Case SortMode
Case bySerieName
Return Comp(Me.SeriesName, Other.SeriesName)
Case ByEpisodeName
Return Comp(Me.EpisodeName, Other.EpisodeName)
Case ByEpisodNumber
If Me.EpisodeNumber < Other.EpisodeNumber Then Return -1
If Me.EpisodeNumber < Other.EpisodeNumber Then Return 1
Return
'etc...
End Select
End
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Hi Fabien,
it's true I should have used enumerators, but other than that my class is nicer <span class="moz-smiley-s4" title=":-P"><span>:-P</span></span>
;-D
Ciao e viva il Cognac!
Gianluigi
</pre>
</blockquote>
</blockquote>
<p>Thanks Gianluigi & Fabien for your replies. I'm confused. I
have the feeling (though I could be wrong as I found the code
examples difficult to follow) that the code in the above solutions
(and in the DynamicMatrix & ClassEUser apps) doesn't do what I
want. As I said in my previous post, I found it quite difficult to
explain what I want. So here is a simple example: 3 rows (the
first one being for one series and the latter two being for
different episodes of the same series) in string array aData with
(string) values as follows:<br>
[0,0]=Storyville -> SeriesName<br>
[0,1]=Dolce Vita Africana ->EpisodeName<br>
[0,2]=1400<br>
[0,3]=Documentary about celebrated Malian photographer Malick
Sidibe.<br>
[0,4]=2008-03-04<br>
[0,5]=b00936cb<br>
[0,6]=Series showcasing the best in international documentaries<br>
[1,0]=EastEnders 2008 -> SeriesName<br>
[1,1]=03/06/2008 -> EpisodeName<br>
[1,2]=1439<br>
[1,3]=Patrick vows to sort Chelsea out and Bradley worries when
his boss crosses the line.<br>
[1,4]=2008-06-03<br>
[1,5]=b00bygpz<br>
[1,6]=Welcome to Walford, E20, in 2008.<br>
[2,0]=EastEnders 2008 -> SeriesName<br>
[2,1]=02/06/2008 -> EpisodeName<br>
[2,2]=1440<br>
[2,3]=Chelsea discovers she is not as untouchable as she thinks.<br>
[2,4]=2008-06-02<br>
[2,5]=b00byf6t<br>
[2,6]=Welcome to Walford, E20, in 2008.</p>
<p>I want the sort results to be:<br>
[0,0]=EastEnders 2008 ->SeriesName<br>
[0,1]=02/06/2008 ->EpisodeName<br>
[0,2]=1440<br>
[0,3]=Chelsea discovers she is not as untouchable as she thinks.<br>
[0,4]=2008-06-02<br>
[0,5]=b00byf6t<br>
[0,6]=Welcome to Walford, E20, in 2008.<br>
[1,0]=EastEnders 2008 ->SeriesName<br>
[1,1]=03/06/2008 ->EpisodeName<br>
[1,2]=1439<br>
[1,3]=Patrick vows to sort Chelsea out and Bradley worries when
his boss crosses the line.<br>
[1,4]=2008-06-03<br>
[1,5]=b00bygpz<br>
[1,6]=Welcome to Walford, E20, in 2008.<br>
[2,0]=Storyville ->SeriesName<br>
[2,1]=Dolce Vita Africana ->EpisodeName<br>
[2,2]=1400<br>
[2,3]=Documentary about celebrated Malian photographer Malick
Sidibe.<br>
[2,4]=2008-03-04<br>
[2,5]=b00936cb<br>
[2,6]=Series showcasing the best in international documentaries</p>
<p>You can see that the the <i>first</i> and the <i>third </i>rows
have been swapped <i>completely</i> i.e. in ALL columns. The sort
order is <b>column 1</b><i> </i>(i.e. <i>EpisodeName</i> using
the original array name) <b>within</b><i> </i><b>column 0</b>
(i.e. <i>Series Name</i> using the original array name).<br>
</p>
<p><br>
PS For reference here is my previous post:</p>
<p>I have 7 string arrays defined as follows:
<br>
Private aSeriesName As String[]
<br>
Private aEpisodeName As String[]
<br>
Private aEpisodeNumber As String[]
<br>
Private aEpisodeDescription As String[]
<br>
Private aEpisodeDatePublished As String[]
<br>
Private aEpisodeIdentifier As String[]
<br>
Private aSeriesDescription As String[]
<br>
<br>
Each array is populated in a loop from a similarly named string
variable e.g. aSeriesName.Add(sSeriesName).
<br>
<br>
The ith element of each array are correspondent to each other
(i.e. like a Relational Database row).
<br>
<br>
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?
<br>
<br>
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
<br>
<br>
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?
<br>
<br>
PS apologies if my explanation is not clear.
</p>
<pre class="moz-signature" cols="72">For reference, here is my previous post:
</pre>
</body>
</html>