Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need idea for sort
Message
From
26/02/2010 06:02:43
 
 
To
26/02/2010 05:50:55
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01451160
Message ID:
01451175
Views:
56
I suggest that you select into a cursor, something like this semicode
Select *,;
  somefunc1(yourfield) as sort1,;
  somefunc2(yourfield) as sort2,;
  somefunc3(yourfield) as sort3,;
  somefunc4(yourfield) as sort4;
  from yourtable into cursor yourcursor order by sort1,sort2,sort3,sort4
Your job will then be to work out the four somefunc() functions, but a combination of val(), getwordnum() and substr() should do the trick. But by doing it this way, you will be able to really see what's happening.


>>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?
>
>
>Agnes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform