Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Truncate decimal zeros
Message
De
01/10/2008 12:28:57
 
 
À
26/09/2008 20:38:45
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Divers
Thread ID:
01351210
Message ID:
01352043
Vues:
29
>>I think there is a way to do this but I'm not sure. Suppose you have a number field defined with 2 decimals. You want to print it in a report but truncate any trailing zeros (and the decimal point if both are zero). Is there a formatting technique that would do this?
>>
>>Thanks
>
>
>SET DECIMALS TO 2
>lnvalue = 2.61
>?IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.99")),1)>"0",ALLTRIM(TRANSFORM(lnvalue,"9,999,999.99")),IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.9")),1)>"0",ALLTRIM(transform(lnvalue,"9,999,999.9")),ALLTRIM(transform(lnvalue,"9,999,999"))))
>lnvalue = 2.60
>?IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.99")),1)>"0",ALLTRIM(TRANSFORM(lnvalue,"9,999,999.99")),IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.9")),1)>"0",ALLTRIM(transform(lnvalue,"9,999,999.9")),ALLTRIM(transform(lnvalue,"9,999,999"))))
>lnvalue = 2.00
>?IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.99")),1)>"0",ALLTRIM(TRANSFORM(lnvalue,"9,999,999.99")),IIF(RIGHT(ALLTRIM(transform(lnvalue,"9,999,999.9")),1)>"0",ALLTRIM(transform(lnvalue,"9,999,999.9")),ALLTRIM(transform(lnvalue,"9,999,999"))))
>
>I can't think of any other way, but maybe someone else can.
>
>I'm just braindead tonight....

Thanks Tracy. Bo has an easier technique.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform