Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the sort order with mixed text/numbers
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00156320
Message ID:
00156330
Views:
29
>I've got a cursor I generate that has a ORDER BY clause that looks like:
>
>ORDER BY Vehicles.Status,Vehicles.Vid
>
>In my table these fields look like:
>
>Status VID
>Available M1
>Available M2
>Available M4
>Available M3
>Available M10
>
>There are some other settings of Status, but that's not where my problem is. What I'd like to see if all of the Status entries are "Available" is a list that looks like:
>
>M1
>M2
>M3
>M4
>M10
>
> Instead, it shows up like:
>
>M1
>M10
>M2
>M3
>M4
>
> I know it's because it's treating the field as alphanumeric, not just numbers. I tried changing the ORDER BY clause to read:
>
>ORDER BY Vehicles.Status,VAL(SUBSTR(Vehicles.Vid,2))
>
>..so it reads the numeric value instead, but VFP doesn't seem to like it. It gives me an error about some missing fields (Column "Status" not found). Is there another way I can do this?
>
>Thanks,

You may change the way you collect the cursor, adding one nore field:
Select VAL(SUBSTR(Vehicles.Vid,2)),Status,vid FROM ... ORDER BY 2,1
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform