Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sorting strings with integers..
Message
De
11/01/2007 19:47:10
 
 
À
11/01/2007 19:16:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01184851
Message ID:
01184856
Vues:
27
>I have records HMD1, HMD2, HMD3... HMD10.. if I do a set order to this field, foxpro lists the records as HMD1, HMD10, HMD2, HMD3..
>
>How can I arrange correctly?

It is treating the numeric digits not as integer numbers but as characters. You need to have the value as:

HMD001,HMD002,.....HMD010, etc.

You have to provide sufficient space for the digits to increment. You can alternatively build the index as follows (assuming the field name is mykey):
INDEX ON LEFT(mykey,3)+PADL(SUBSTR(mykey,4),4,"0") TAG mykey
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform