V4RB, syntax for sorting of sets.
erne
ernestogiannotta at tiscalinet.it
Wed Oct 6 16:45:19 CDT 2004
Hi Ruslan,
on 5-10-2004 23:11, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:
> 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...
>
>
I could think of a vOrder object
I have similar object for a query class I've defined
it has a prop
vSort array
vSort has props
field as vField
ascending as Boolean
vOrder has also some methods like
AddSort(theField as vField, theOrder as Boolean = true) // order defaults
to ascending
HTH
Cool Runnings,
Erne.
--
| e r | Ernesto Giannotta
| n e | Musical Box - a media store
More information about the Valentina-beta
mailing list