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

One question I've had in the back of my mind.

You described the equation as: (A / (B + C + D ) )*100

But, the actual formula was (A / (A + C + D ) )*100

Are you sure you want to duplicate the function in both the divisor and dividend?

Jay

>Hi Jay,
>I took the second route as I didn't know how to carry out the first one.
>The report opens but the result is still 0. When I calculate by hand what the result should be I get 78.2 as the result.
>Thanks
>Max
>> Max --
>
>> You could go a couple ways.
>
>> My natural preference would be to calculate this before running the report, if you need it calculated once as the sum of the records.
>
>> In the report, substitute nmyTempPublicCalc for calls to Calcrpt().
>
>> Then couch your call to the report with this code.
>
>> PUBLIC nmyTempPublicCalc
>> CALCULATE SUM (Calcrpt()) FOR FilterUsedOnReport TO nmyTempPublicCalc
>
>> REPORT FORM ....
>
>> RELEASE nmyTempPublicCalc
>
>> There are more sophisticated ways of defining the scope of the variable, but this should get the job done. This is probably faster than the next option.
>
>> Another way would be to define a report variable MyCalc (or whatever). Check the "Sum" line in the Calculate box. Then, in Value to Store, put in Calcrpt(). Then, use the MyCalc variable in place of the function call. This is probably simpler than the first option.
>
>> HTH!
>
>> Jay
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform