Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Percentage calculation in expression of report
Message
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00588031
Message ID:
00588144
Vues:
22
>I have an expression in a report that should calculate percentages. It is in the form (A / (B + C + D ) )*100 but it also includes a .prg in the calculation. It is returning a 0.00 value when run. Can anyone please help with the proper code?
>The following is the code I am using:
>( calcrpt() / ( calcrpt() + table.field + table.field2 ) ) * 100
>
Where do you use your expression?
Create a Report varaible called nCalCrpt
Set it to be CalCrpt()
Release at the end of report (this, unfortunately, has some bug, but it's not relevant here)

Your expression now would be: (check for possible division by 0)
iif(nCalCrpt+Field1+Field2>0, nCalCrpt/(nCalCrpt+Field1+Field2)*100,0)

>the .prg is the calcrpt() and when used by itself in another expression on the same report works correctly.
>
>Thank you!
>Max
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform