Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need idea for sort
Message
De
26/02/2010 06:19:06
 
 
À
26/02/2010 05:50:55
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:
01451186
Vues:
39
>>Still not clear I'm afraid. Taking '1.10.R.1' as an example: As I understand it you break it down to 4 fields (stop is always a seperator - never a decimal point) i.e:
>>1
>>10
>>R
>>1
>>For sorting purposes should the items that look like numbers be treated as numbers or character strings? Is there a maximum length to any field within a record or for the number of fields that a record can contain?
>>eg. Could '123.345678.ABC.234' occur?
>
>Hi Viv, Tore,
>
>>Still not clear I'm afraid.
>You are not the only one.
>
>I try to answer all at once here.
>
>The point separates the words. (It would be Decimal separator anyway because this is germany 1k=1.000; a tenth = 0,1)
>
>The lenght of a single word is limited by the length of the field that holds the value.
>
>The words are numbers only in the sense of sort. I think words starting with an alpha should go behind those starting with numbers.
>
>*sorted
>1.01
>1.2
>1.10.R.1
>1.200
>1.R
>
>the field is 40 chars, so worst case could be a single word of 40 chars or 21 words of a single char.
>
>Did I mention that I found a record with 10DP, eg mixed digits/alphas in a word? I hate this. I have no idea where to sort this in. This is out of the specs but what does the customer care about specs?

For simplicity I'd go with parsing each 'field' and padding it out. So for the example above you'd end up with something like:
001.001
001.001
001.010.R.001
001.200
001.R
A simple index on the whole record should then give you a valid sort. I guess something like the '10DP' would need a routine to insert stops before padding.....
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform