Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get a different order than default on numeric
Message
De
19/12/2003 16:50:23
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00860843
Message ID:
00860870
Vues:
15
>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.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform