Possible TppVariable Calcuation Issue
Hi,
I have a TppVariable on a SubReport that basically does a number of
different calcuation and updates some variable on the main report (through
global variables). The TppVariable itself does not display any value and
it's visibility is set to false. The Timing is set to Traversal with Reset
on ReportEnd. If the TppVariable type is set to Integer then the OnCalc
event fires correctly and the correct number of times (at leaset I get the
right calcuated values). However, if I change the TppVariable to type to
String then the OnCalc event seems to fire improperly (as I get the wrong
calcuated values). Becaue the TppVariable isn't actually displaying
anything I would have thought the Type would be irrelevant and the OnCalc
event would fire the same regardless. The OnCalc event is being added in
code and not through RAP but the report is designed and the TppVariable
added by double-clicking on the TppReport component at design-time. Anyway,
this behaviour does not seem right to me.
If you need any further information, please do not hesitate to ask.
Thanks,
Scott
I have a TppVariable on a SubReport that basically does a number of
different calcuation and updates some variable on the main report (through
global variables). The TppVariable itself does not display any value and
it's visibility is set to false. The Timing is set to Traversal with Reset
on ReportEnd. If the TppVariable type is set to Integer then the OnCalc
event fires correctly and the correct number of times (at leaset I get the
right calcuated values). However, if I change the TppVariable to type to
String then the OnCalc event seems to fire improperly (as I get the wrong
calcuated values). Becaue the TppVariable isn't actually displaying
anything I would have thought the Type would be irrelevant and the OnCalc
event would fire the same regardless. The OnCalc event is being added in
code and not through RAP but the report is designed and the TppVariable
added by double-clicking on the TppReport component at design-time. Anyway,
this behaviour does not seem right to me.
If you need any further information, please do not hesitate to ask.
Thanks,
Scott
This discussion has been closed.
Comments
This is functioning as designed. The OnCalc event of a String variable will
fire differently than one with a numeric type. Basically if you are making
numeric calculations, you need to be sure the TppVariable is set to use a
numeric type as well.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'm a bit confused as to how or why it would fire differently.
How does it fire differently? Does it still not fire once per Traversal?
Is it still not guaranteed to fire only once per Tranversal?
Does it fire differently for Integer type versus Currency type? What types
specifically does it fire differently for?
Because the OnCalc of a TppVariable is the only event that is guaranteed to
fire only once per traveral we use it heavily to do complex calcuations.
Normally we do multiple calcuations within a single TppVariable and the
TppVariable used to do the calcuations is not the same TppVariable to
display the results.
Because we aren't assuing a Value to the TppVariable and using it to display
anything (most often it is invisible), I figured the Type would not make a
diffeence. As long it it fired only once per Traveral I figured it won't
matter.
Maybe understanding how it fires differently (and why) will help me better
understand and use it properly in the future.
Thanks for any insight.
Scott
It is necessary for a dtString type variable to call its Compute routine
when the page starts to cover a number of special cases (one being retaining
the proper text as the report is paged backward). In order to cover these
special cases and sill keep validity in numeric calculations, we decided to
just change the behavior of String based TppVariables.
The Variable component has a long history of limitations. Over time we have
gradually removed these limitations as best we can, however as you know one
small change to a component so precise, can affect thousands of existing
reports.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks for the explanation.
So just to be clear, the OnCalc event of the TppVariable when it is set to
one of the numerical types is guaranteed to fire only once per Traversal
(record). And is still the best event to use for numerical calcuations
versus the BeforeGenerate even of the Detail band?
Thanks,
Scott
Yes, this is correct.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com