Triggering SummaryBand ppVariable Calc
I'm having trouble getting ppVariables in Report Footer summary bands to
calculate before being printed.
I have ppVariables in a Report Footer summary band whose values depend on
other ppVariables in the same summary band. For example, I have totals for
wholesale and retail costs, and based on the values of those two totals I
need to calculate Gross Profit (the difference), Margin % (based on a ratio)
etc.
My problem is that the variables are being printed before they're
calculated. (I know this from setting breakpoints in the OnCalc and OnPrint
events.) They therefore come up as zeroes. The only way I've found to assign
them meaningful values is by setting CalcType to veTraversal. This performs
the Report Footer calculations every time a record is traversed, including
the last one, which works for the sake of printing but is overkill. It also
doesn't work for situations where I need some other action to be taken once
and once only in the summary band.
Surely there's a way to set CalcType and CalcComponent to trigger
ppVariables in a summary band to calculate -- once -- before being printed.
No?
--
Stephen Aberle {{8^{ )}
Programmer, Unipharm Wholesale Drugs Ltd.
mailto:stephen_a@unipharm.com
calculate before being printed.
I have ppVariables in a Report Footer summary band whose values depend on
other ppVariables in the same summary band. For example, I have totals for
wholesale and retail costs, and based on the values of those two totals I
need to calculate Gross Profit (the difference), Margin % (based on a ratio)
etc.
My problem is that the variables are being printed before they're
calculated. (I know this from setting breakpoints in the OnCalc and OnPrint
events.) They therefore come up as zeroes. The only way I've found to assign
them meaningful values is by setting CalcType to veTraversal. This performs
the Report Footer calculations every time a record is traversed, including
the last one, which works for the sake of printing but is overkill. It also
doesn't work for situations where I need some other action to be taken once
and once only in the summary band.
Surely there's a way to set CalcType and CalcComponent to trigger
ppVariables in a summary band to calculate -- once -- before being printed.
No?
--
Stephen Aberle {{8^{ )}
Programmer, Unipharm Wholesale Drugs Ltd.
mailto:stephen_a@unipharm.com
This discussion has been closed.
Comments
same band. It affects the order of which their OnCalc fires. Only use the
OnCalc events to perform calculations with variables.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
(for example) Gross Profit and Margin to be higher (which, I assume, means
later) than the source variables. Their values are still left at zero and,
as I mentioned before, the OnPrint event fires before the OnCalc event for
these variables when I set them to a CalcType other than veTraversal.
-Stephen Aberle.
There is a drop down list in the left side of the tool bar where you can set
it. It defaults to String.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
- Stephen.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
CalcType to veOverkill, whups I mean veTraversal ;-)
- Stephen Aberle.
traverses through the dataset, generating detail bands, it triggers the
OnCalc events of the variables and the dbCalcs in the entire report. If the
variable is in the summary band, and the timing is set to calculate on
traversal, then the OnCalc fires every time the record position moves
forward. Ok, this works well, but if you only want to perform a calculation
once when the summary band prints, then use the SummaryBand.BeforePrint
event to perform the calculations.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com