Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function to order numeric values
Message
 
To
22/10/2008 12:34:40
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01356353
Message ID:
01356358
Views:
28
>I have this function someone gave me that works in another language (SQL server i think) and I made changes (minor) to make it work in foxpro. It is supposed to take all the numbers in 1 column and update another column with the values ordered numerically. i.e.:
>
>column1 column2
>235251 122355
>872919 127899
>123534 123345

Maybe:
CLEAR
? OrderNumerics(235251)
? OrderNumerics(872919)
? OrderNumerics(123534)


FUNCTION OrderNumerics(lnNumber)
 LOCAL lcNumbers, lcRetVal
 LOCAL lnFor
 lcRetVal     = []
 lcNumbers    = TRANSFORM(lnNumber)
 FOR lnFor = 0 TO 9
     lcRetVal = lcRetVal + CHRTRAN(lcNumbers, CHRTRAN(lcNumbers, TRANSFORM(lnFor), []), [])
 NEXT
RETURN VAL(lcRetVal)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform