Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need idea for sort
Message
De
26/02/2010 09:22:49
 
 
À
26/02/2010 08:30:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01451160
Message ID:
01451224
Vues:
38
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform