Accessing a DBCalc value (set to sum)
Q1:
Simplest case:
I have a ppVariable and a ppDBCalc on the same group header.
As an example, say I wanted to use the value of the DBCalc in the Variable,
how/when can I access the *final* value of the DBCalc - which is set to SUM.
Something like - ppVariable.Value := 'Total Product cost is ' +
FloatToStr(ppDBCalc.Value);
It can be accessed during its OnCalc (which isn't great, because its firing
for every record being summed) but then the OnCalc fires once more before
the page prints - and this time - only for the first record - so the SUM
value is wrong.
Tried every possible combination of beforeprint, beforegenerate,
aftergenerate... etc.
Q2:
Can I place a DBCalc on a band, and have it SUM - with the pipeline of the
DBCalc connected to a different pipleline to that of the subreport?
Thanks very much.
Simplest case:
I have a ppVariable and a ppDBCalc on the same group header.
As an example, say I wanted to use the value of the DBCalc in the Variable,
how/when can I access the *final* value of the DBCalc - which is set to SUM.
Something like - ppVariable.Value := 'Total Product cost is ' +
FloatToStr(ppDBCalc.Value);
It can be accessed during its OnCalc (which isn't great, because its firing
for every record being summed) but then the OnCalc fires once more before
the page prints - and this time - only for the first record - so the SUM
value is wrong.
Tried every possible combination of beforeprint, beforegenerate,
aftergenerate... etc.
Q2:
Can I place a DBCalc on a band, and have it SUM - with the pipeline of the
DBCalc connected to a different pipleline to that of the subreport?
Thanks very much.
This discussion has been closed.
Comments
As a rule of thumb, it is usually best to only use TppVariables when making
calculations inside a report. The DBCalc components are not designed to be
used in other calculations or with other components. I would suggest
calculating your sums manually using TppVariables, then using their values
in the other variable you already have. This will also make it easier to
calculate the sum from a different pipeline inside a subreport.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com