V4RB, syntax for sorting of sets.

Ruslan Zasukhin sunshine at public.kherson.ua
Wed Oct 6 15:50:47 CDT 2004


On 10/6/04 3:33 PM, "Sims, John" <AYU8 at CDC.GOV> wrote:

>> I want discuss one point.
>> 
>> So let we have selection as result of Find()
>> 
>>     dim set as Vset
>> 
>> Now I add to Vtable class new method
>> 
>>     Sort( set, fld, Ascending ) as VSet
>> 
>> This method allow us to sort selection of found records by
>> single field. Also we must to have other function, that will
>> allow us sort by few fields.
>> 
>> It can looks for example as
>> 
>>     Sort( set, order() as VSortPair ) as VSet
>> 
>> 
>> Then in REALbasic code we could do
>> 
>>     dim order as array  ?
>> 
>>     order(1) = new VSortPair( f1, kAsc )
>>     order(2) = new VSortPair( f3, kDesc )
>>     order(3) = new VSortPair( f2, kAsc )
>> 
>>     SortedSet = t.Sort( set, order )
>> 
>> 
>> Do you like such syntax?
>> 
>> It seems we have no other way for RB...
>> 
> 
> Hi Ruslan,
> 
> I personally think that would work fine.  I have one question.  Are the
> fields (f1,f2,f3) in your example Vfields or the name of the field as a
> string -- or could we have both :-)  ?

This can't be name because then IN WHICH TABLE ?

> FYI, REALbasic doesn't have a "dim as array", the REALbasic code would
> look something like...
> 
> Dim order() as VSortPair
> 
> Order.append(new VSortPair( f1, kAsc ))
> Order.append(new VSortPair( f3, kDesc ))
> Order.append(new VSortPair( f2, kAsc ))
> 
> SortedSet = t.Sort( set, order )



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