Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Nasty index, any better ideas?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00817470
Message ID:
00817500
Vues:
20
i don't know if you consider padl() and allt() as less-standard vfp functions (you probably do), but howabout
index on iif(!Isalpha(CatNumber), padl(allt(CatNumber), FldLength, "0"), CatNumber) tag CatNumber
>I have a data field of mixed alphanumeric that needs a specific sort order. I think this is enough points to illustrate. They are either all integer data points, or begin with an alpha and the rest is numeric. Example:
>
>Unordered data: B16,16,C2,5,123,2,C21,D86,278,27,2796,B1,C22
>
>Ordered data: 2,5,16,27,123,278,2796,B1,B16,C2,C21,C22,D86
>
>Here's my quickly devised ordering method, call the field CatNumber (yeah, I know, yuck, this is not very elegant):
>
>INDEX ON IIF(ISALPHA(SUBSTR(CatNumber,1,1)),;
>1000*ASC(SUBSTR(CatNumber,1,1))+VAL(SUBSTR(CatNumber,2)),;
>VAL(SUBSTR(CatNumber,1))) TAG CatNumber
>
>The "1000" multiplier is big enough for all possible data points, BTW. It works, if a bit ugly, so why the problem? I'm doing a hobby-article for not very deep coders - people that have only MS Access available, IOW. And I don't find Access supporting the above solution. Anyone see any ideas that are simpler, and might work in Access? Just a "simpler vfp index" would be a good start for the Access stage...
>
>(Note: I'm avoiding any possible less-standard vfp functions like LEFT, also, as part of this project.)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform