Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bug in PADL command?
Message
De
01/06/2006 05:17:38
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01126320
Message ID:
01126404
Vues:
21
This message has been marked as a message which has helped to the initial question of the thread.
>>>>
PADL(MTON(yAmount),9,'0')
>>>>
>>>Thanks. I haven't used this function before.
>>
>>Neither did I. I avoid using Money/Currency data types because it requires special handling in some cases w/o providing any advantages over numeric data types.
>
>We're using Currency here for all amount fields. BTW, I just realized we better would use Borislav's idea, because we need 2 digits after ., not 4.

TRANSFORM(), like PADX(), doesn't round the output, it trunc:
* a bug exists, and with a mask TRANSFORM() uses the SET("Decimals") setting
SET DECIMALS TO 18
? TRANSFORM($1.8199,"@R 99999.99")
? TRANSFORM(ROUND($1.8199,2),"@R 99999.99")

* YOU CAN USE str() OR cast(), BUT they are buggy
?
? "expected 0     0"
? STR(0.4995,10,0),CAST(0.4995 as N(10,0))
? STR($0.4995,10,0),CAST($0.4995 as N(10,0))

* you can round() it before, 
* but don't convert the currency to numeric, 
* because ROUND() is not perfect with all numeric values .
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform