Calculations in a group band
Hi All,
My report has the following columns: Account, Regular, Overtime, Overhead,
EffectiveRate. It is grouped by Account. EffectiveRate is a calculated
field. In the detail band I added all the components for the fields and
added a TppVariable component for EffectiveRate and wrote the code for
calculation as Value := Src['Overhead'] / (Src['Regular'] + Src['Overtime'])
* 100. The detail works fine.
In the group band for Account I added TppDBCalc components to sum Regular,
Overtime and Overhead. How do I get the EffectiveRate and what component
should I use. As obvious, it should equate to Sum of Overhead / (sum of
Regular + Sum of Overtime) * 100.
I do not want to write any code in Delphi (like using OnCalc routine of the
dataset) as this report is part of a generic reporting application and I
would like to have any calculation code inside the reportbuilder template,
which I load dynamically when the user selects a report.
Thanks in advance.
Manan
My report has the following columns: Account, Regular, Overtime, Overhead,
EffectiveRate. It is grouped by Account. EffectiveRate is a calculated
field. In the detail band I added all the components for the fields and
added a TppVariable component for EffectiveRate and wrote the code for
calculation as Value := Src['Overhead'] / (Src['Regular'] + Src['Overtime'])
* 100. The detail works fine.
In the group band for Account I added TppDBCalc components to sum Regular,
Overtime and Overhead. How do I get the EffectiveRate and what component
should I use. As obvious, it should equate to Sum of Overhead / (sum of
Regular + Sum of Overtime) * 100.
I do not want to write any code in Delphi (like using OnCalc routine of the
dataset) as this report is part of a generic reporting application and I
would like to have any calculation code inside the reportbuilder template,
which I load dynamically when the user selects a report.
Thanks in advance.
Manan
This discussion has been closed.
Comments
work and then copy the event handler code to RAP, You can use TppVariables
to perform the statistical calculations based on the DBCalcs values. The
DBCalcs should fire before the variables in the same band. You can use all
TppVariables, then if you want to control the order in which variables
calculate, use their CalcOrder property to set the timing in which they fire
their OnCalcs for a single band they are contained in. The CalcOrder
doesn't work across mulitple bands.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
What I did was put a TppVariable component in the group band. The group band
has another component AOHCalc which is a TppDBCalc. I wrote Value :=
AOHCalc.Value in the Calculation for the TppVariable component. But the
value always comes out to 0. What should I be setting in the Timing
properties? Thanks in advance.
Manan
is string and this will result in a value of zero when you are trying to use
it as a numeric variable.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
Manan