Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRANSFORM() depends on SET DECIMAL. Bug?
Message
From
21/07/2004 11:42:39
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
21/07/2004 11:36:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00926580
Message ID:
00926588
Views:
22
Transform() has several problems, and behaviour changes, since VFP 6 (the first version where it is supported without the second argument).

I think you can use it safely for integers.

However, if you need reliable results with transform() and decimals, better make your own version, as a UDF.

Basic approach: use str() to specify a large number of decimals (perhaps 6, or 10); use strtran() to replace zeroes with spaces; use alltrim(); replace spaces back to zeroes.

>
SET deci to 2
>?TRANSFORM(1.12345,'999999.99999')
>
>Observed result
>
>1.12
>
>Expected result:
>
>1.12345
>
>occurs on : vfp 7, vfp 9 beta
>
>Is this VFP bug ?
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform