Using of ppDBCalc Lookahead Value
Hi
I want to create a Report which should look like the following example
Group Header
Val Sum per cent
3 12 40%
5 12 42%
4 12 30%
Sum 12
....more groups ...
therefore i put the following in the detail band
ppDBText1 ppDBCalc1 ppLabel1
both connected to the same numerical field
ppDBCalc1.LookAhead=true
ppDBCalc1.dbCalcType=dcSum
I thought in ppLabel1.onPrint I could do something like
if ppReport.Secondpass then
ppLabel1.caption:= DataSet.fieldbyname('Val').asFloat/ppDBCalc1.value;
but it don?t work that way
(ppReport.PassSetting=psTwoPass of course)
I use RB6.03 Std
can somebody help me?
best regards,
Oliver
I want to create a Report which should look like the following example
Group Header
Val Sum per cent
3 12 40%
5 12 42%
4 12 30%
Sum 12
....more groups ...
therefore i put the following in the detail band
ppDBText1 ppDBCalc1 ppLabel1
both connected to the same numerical field
ppDBCalc1.LookAhead=true
ppDBCalc1.dbCalcType=dcSum
I thought in ppLabel1.onPrint I could do something like
if ppReport.Secondpass then
ppLabel1.caption:= DataSet.fieldbyname('Val').asFloat/ppDBCalc1.value;
but it don?t work that way
(ppReport.PassSetting=psTwoPass of course)
I use RB6.03 Std
can somebody help me?
best regards,
Oliver
This discussion has been closed.
Comments
For the percentages, you will need to code a list of summary values for the
group totals. Then in the second pass, pull the totals for the group out of
the list in the calculation instead of using the LookAhead values.
The LookAhead values are implemented such that the draw commands are altered
when the final calculation is performed for the total. This means that all
the calculation event to generate the page, have already been fired, so the
LookAhead value is going to be assign too late.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
The report was set to TwoPass. On the first pass i calculate the SUM column, in
the second pass i calculate the Percentage column.
I stored the SUM value into a private delphi variable and had careful about only
increment it on the first pass of the report.
It works fine for me.
bye