Sum problem (Newbie)
Hi !
I have just started using Report Builder, and have run into a, I hope,
simple problem.
My report consists of a Main Report with a SubReport with PrintBehavior set
to pbChild.
In my Main report I have a ppDBCalc field that produces a sum, In the
SubReport I also have a ppDBCalc field that produces a sum.
I have tried to make a sum out of these two using a variable field, but at
the time the GetText of the variable field fires, the value of the DBCalc
fields have not been completely calculated. In fact it seem that the
position of the calc field is in the first record of the dataset.
Can anyone help me on how to calculate a field from a subreport with a field
on the main report ?
Petter
I have just started using Report Builder, and have run into a, I hope,
simple problem.
My report consists of a Main Report with a SubReport with PrintBehavior set
to pbChild.
In my Main report I have a ppDBCalc field that produces a sum, In the
SubReport I also have a ppDBCalc field that produces a sum.
I have tried to make a sum out of these two using a variable field, but at
the time the GetText of the variable field fires, the value of the DBCalc
fields have not been completely calculated. In fact it seem that the
position of the calc field is in the first record of the dataset.
Can anyone help me on how to calculate a field from a subreport with a field
on the main report ?
Petter
This discussion has been closed.
Comments
I solved the problem by reading the value of the ppDBCalc.Value on the
AfterGenerate event of the Band.
And then I calculated the total.
Petter
variable in the subreport, update the value of a variable in the main
report. This way you'll only have one event handler that updates both the
variable in the subreport and the variable in the main report.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Why use the event handler of variable in the subreport ?
Is it the Subreport that is executed first ?
Petter
every detail record. You can then use this to update the variable in the
main report. The variables only calculate based on the record change of he
report that they are in. The variable in the main report will onyl fire its
OnCalc as the master repot's data pipeline is traversed. The subreport's
veriable will fire for every detail record in the report. If you want a
running total or calculation in the main report based on the subreport, then
you can use this approach to do so.
Here is an example of using variables to perform calculations over groups of
data:
http://www.digital-metaphors.com/tips/PercentageOfGroupTotal.zip
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com