Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Function to order numeric values
Message
 
À
22/10/2008 12:34:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01356353
Message ID:
01356358
Vues:
25
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform