General information
Category:
Reports & Report designer
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
>Hi Jay,
>I think I know what I am doing wrong, the problem is how do I fix it! :)
>the calcrpt() is used for each row on the report so what I need is the sum of the calcrpt() which is done at the end of the report. How would I code for that? Something to the effect of the following?
>( SUM(calcrpt()) / ( SUM(calcrpt()) + myTable.field + myTable.field2 ) ) * 100
>
>Thanks again!
>Max
>
>
>> 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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only