Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need idea for sort
Message
De
01/03/2010 04:48:41
 
 
À
01/03/2010 01:11:40
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01451160
Message ID:
01451713
Vues:
41
Maybe (based on Tore's table ):
SELECT MAX(GETWORDCOUNT(VALUE,".")) FROM C_Test INTO ARRAY Fred
INDEX ON PADR(GETVAL(VALUE),Fred(1),CHR(0)) TAG SORTED


PROCEDURE GETVAL
LPARAMETERS tcField
LOCAL lcWord, lcResult
lcResult=""
FOR x = 1 TO GETWORDCOUNT(tcField,".")
  lcWord = GETWORDNUM(tcField,x,".")
  lcResult = lcResult + IIF(VAL(lcWord)>0,CHR(VAL(lcWord)),CHR(ASC(lcWord)+165))
ENDFOR
RETURN lcResult
ENDPROC
But you'd still need something to insert any missing ',' first :-{
>I will give it a try, if I found a way to code it. ::)
>
>Agnes
>
>>
>>One other approach which I think would work (providing no numeric field exceeds 229): Convert to an ASCII string and index on that. ie.
>>Translate each numeric field to a character of that value and each alphabetic character to its ASCII value + 165 and add a CHR(0) on the end. So
>>1.1 = CHR(1)+CHR(1)+CHR(0)
>>1.02.N.R = CHR(1)+CHR(2)+CHR(ASC("N")+165)+CHR(ASC("R")+165)+CHR(0)
>>
>>I *think* indexing on this gives the right result. Haven't thought through the actual code to translate this but it should be at least as simple as using a stack of PADL() and PADR() stuff......
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform