Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get a different order than default on numeric
Message
From
19/12/2003 16:50:23
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00860843
Message ID:
00860870
Views:
14
>I'm getting a cursor full of data from a SQL Server table, I need to order the data based on a decimal field I receive.
>
>
>  Select * from curSQLData order by LayoutValue into cursor curFillData
>
>
>Sample data from Current query:
>
>4.1000
>4.1100
>4.2000
>
>
>I need to get it to order like:
>
>
>4.1000
>4.2000
>4.1100
>
If I got you right, you want the right zeros stripped from the decimals, and then to convert to integers... I see no easy way to do that on SQL side, but when you get the data down, let's assume that you've added another column fldSort n(10,4):
scan
   lcStr=substr(str(LayoutValue), at(".", str(LayoutValue))+1)+" "
   do while "0 "$lcStr
      lcStr=strtran(lcStr, "0 ", " ")
   enddo
   replace fldSort with int(LayoutValue)+val(lcStr)/10000
endscan
Then index on fldSort, or Select * ... order FldSort

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform