Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need idea for sort
Message
From
26/02/2010 09:22:49
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
 
 
To
26/02/2010 08:30:36
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01451160
Message ID:
01451224
Views:
37
Hi Tore,

as we think alike,
>You separate the numeric part,

this is a nice doc for my idea ;-)

>Then you can't have done as I explained? You do all this in ONE operation, either with inline functions or with separate functions. By the way, I got another solution. You separate the numeric part, by using chrtran(), and convert it into a numeric value. Then you use int() on this value to separate the first part. The remainder is the second value to sort on.

no need to use chrtran, as
a) val() works perfectly well on mixed strings [Val("135test...")] and
b) chrtran(field, "a..z"+"A..Z", "") might be problematic in cases like "10.20C05.12x0"
c) if a UDF is called, at least from pure perf the following is better (beauty in the eyes...)
Select somefunc1(yourfield, @Col2, @Col3, @Col4) as sort1;
   , Col2 as sort2 ; 
   , Col3 as sort3;
   , Col4 as sort4;
from yourtable into cursor yourcursor order by sort1,sort2,sort3,sort4
even faster but even less readable would be the filling of private array rows inside somefunc1
["very evil grin" tag suppressed by UT software]

regards

thomas
Previous
Reply
Map
View

Click here to load this message in the networking platform