Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
TRANSFORM() depends on SET DECIMAL. Bug?
Message
De
21/07/2004 11:42:39
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
21/07/2004 11:36:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00926580
Message ID:
00926588
Vues:
20
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)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform