Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Alltrim for numeric variables
Message
 
 
To
18/06/2001 20:34:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00520367
Message ID:
00520838
Views:
27
>>? ">" + 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.

Dragan,

It's a known fact, that transform has a bug. See this KB artcile for details
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform