Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Percentage calculation in expression of report
Message
From
30/11/2001 12:39:36
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00588031
Message ID:
00588111
Views:
35
Max --

Nothing leaps to mind...

A couple areas:
1. Test if it's a calculation issue.
From what you describe, I think it would be easy to separate the function from the report and test to see with specific input if you're getting the output you expect.

SET DEFAULT TO (Drive\Path\PrgContainingCalcRpt)
USE myTable
GO TOP
? ( calcrpt() / ( calcrpt() + myTable.field + myTable.field2 ) ) * 100

2. Test if it's a display issue.
If your denominator values are large, it's possible that the 2 decimal places you have defined for the report field won't display anything. Expand to a few more decimal places and see if you get some result.

Confirm that you have your display field set up appropriately.

HTH,

Jay



>The code very long but basically the sum of a large number of fields:
>
>* calcrpt.prg
>local lReturnValue
>
>lReturnValue = table.wed32+table.wed43+table.thu32+table.frisdr+ (many more fields added)
>
>return lReturnValue
>
>>> Hi!
>
>>> What's the code for calcrpt()?
>
>>> Jay
>>>>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

the .prg is the calcrpt() and when used by itself in another expression on the same report works correctly.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform