Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alltrim for numeric variables
Message
De
18/06/2001 20:34:56
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00520367
Message ID:
00520817
Vues:
17
>? ">" + transform( my_variable ) + "<" >

Recently I had a nasty surprise with this. I had a loop to name the variables to use in a macro (because I had to loop through field1, field2, field3, ..., field45), and I used
cFieldName="field"+tran(i)
where i was the loop counter. To my surprise, when it ran it banged on
cValue=eval(cFieldName)
because the value in cFieldName was Field1.000000000 - probably the loop counter got created with some accidental (?) decimals. Luckily, I knew that the structure of the table will not change and that field1 is the 10th field, so I used
cValue=eval(fields(i+9))
instead. Still, this accident got me thinking... will tran(integer) always yield a string representation of a number without a decimal point, or is it something to watch out for and code around.

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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform