[V4RB V2] VArraySet sorting problems

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Mar 22 21:13:51 CST 2005


On 3/22/05 8:58 PM, "Erik Mueller-Harder"
<valentina-list at vermontsoftworks.com> wrote:

Hi Erik,
 
> I'll submit this to Mantis shortly, but I'd like your comments first,
> in case I'm not understanding something.
> 
> I'm using this code to create a sorted VArraySet in Rb:
> 
> Dim ascendingFlg as Boolean
> Dim text as String
> Dim iSet as VArraySet
> Dim vs as VSet
> 
> text = staticText1.text
> if text <> "" then
>    vs = iTable.FindWords(text)
>    if vs <> nil then
>      if vs.count > 0 then
>        ascendingFlg = False
>        iSet = iTable.Sort(vs, iTable.chosenDT, ascendingFlg)
>      end if
>    end if
> end if
> 
> iTable is a VTable subclass.  chosenDT is a VDateTime field, with good
> data in it.
> 
> This is working beautifully, except that the resulting iSet is not
> sorted.
> 
> In your Records_Sort example, the result of the table's sort is
> actually defined as a VSet, not a VArraySet -- and it is working
> correctly.

I think this do not mater.

> The documentation, however, says the result should be a VArraySet --
> and that is actually what I want (since I want to use the VArraySet's
> ItemAt method).

But ArraySet is child of Vset. So I always have right to write

    dim set as VSet
    set = tbl.Sort()

Although in this case I cannot access methods of ArraySet class.
In my example I do not need them, so I have cast to set.
This is pure OO issues, Erik.

> Switching ascendingFlg to True has no effect.
> 
> This code was working for me two or three weeks ago; I don't believe
> anything has changed other than the version of Valentina.  I'm
> currently using the most recent v2 beta, from 2005-03-10.
> 
> Is this a bug?  Or am I doing something incorrectly?

I can think only about bug related to Vdate field.
Hmm, please try some other numeric field.
If in this case answer is correct.

> -----------
> 
> [On a related note, FYI, I've noticed that in all circumstances, even
> when sorting works correctly (such as your Records_Sort example), the
> VSet's (or VArraySet's) IsSorted method *always* returns False.]

    Set.IsSorted() and set.Sort()

Are related to sorting of RecIDs inside of set.
I afraid this will confuse RB developers, and may be should be removed.

Ignore them for now. They exists for other tasks.


-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------




More information about the Valentina-beta mailing list