[V4RB V2] VArraySet sorting problems

Erik Mueller-Harder valentina-list at vermontsoftworks.com
Tue Mar 22 13:58:16 CST 2005


Hi, Ruslan --

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.

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).

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?

-----------

[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.]

Thanks,

-- Erik



More information about the Valentina-beta mailing list