TPPVariable value being cleared
Hi,
I'm getting some odd behaviour with a TppVariable having it's value cleared
after I set it (this is behaviour that didn't happen in ver 12 of report
builder but it now does happen in Rb ver 14).
The report has a detail band with a couple of TppVariables. The report
pipeline links to a dataset (cdsGrower) with 2 records and the detail band
prints exactly the same data for both records, the only data that changes is
the contact/address info in the header (i.e. it's the same report going to
two different people).
I'm calculating the values for my 2 TppVariables in the
cdsGrower.AfterScroll event handler. Somewhere between the AfterScroll
event and the detail band BeforePrint event (I put a break point in both)
the values of the TppVariables are getting zeroed. The first page prints and
the TppVariables print as zero, when the second page prints the TppVariables
print with the correct values.
The zeroing is happening inside report builder, the values are not getting
set anywhere in my code except in the AfterScroll event handler, and it only
seems to happen for the first page.
Any ideas please?
TIA
Willie
I'm getting some odd behaviour with a TppVariable having it's value cleared
after I set it (this is behaviour that didn't happen in ver 12 of report
builder but it now does happen in Rb ver 14).
The report has a detail band with a couple of TppVariables. The report
pipeline links to a dataset (cdsGrower) with 2 records and the detail band
prints exactly the same data for both records, the only data that changes is
the contact/address info in the header (i.e. it's the same report going to
two different people).
I'm calculating the values for my 2 TppVariables in the
cdsGrower.AfterScroll event handler. Somewhere between the AfterScroll
event and the detail band BeforePrint event (I put a break point in both)
the values of the TppVariables are getting zeroed. The first page prints and
the TppVariables print as zero, when the second page prints the TppVariables
print with the correct values.
The zeroing is happening inside report builder, the values are not getting
set anywhere in my code except in the AfterScroll event handler, and it only
seems to happen for the first page.
Any ideas please?
TIA
Willie
This discussion has been closed.
Comments
TppVariable in the detail band was not reset each time the data
traversed. Are you certain you do not have your Variable.ResetType set
to veTraversal?
Note that all calculations made for variables should be done using the
OnCalc event of the variable. This ensures that each calculation only
happens once per traversal. You can use the timing dialog (right click
the variable) to define when the value is calculated and reset.
If you are still having and issue with this, please put together a
minimal application I can run here using only RB and Delphi components
and send it in .zip format to support@digital-metaphors.com and I'll
take a look at it for you.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks for the response You were correct, it was set to veTraversal, which
was different to our previous version code, so that explains why it stopped
working ( I just don't know how it got set to veTraversal) . I also took
your advice and used the OnCalc to set the value.
regards
Willie
report with this new version of report builder. An example is I can
"preview" a report which contains some labels and lines I create "on the
fly" - all good, I can then "print" the same report all good but when I
generate a PDF the "on the fly" created components don't print, however if I
generate the PDF without first previewing or printing it then it's all good.
Any suggestions please?
event code and try again. If this fixes the dissapearing component
issue, periodically begin adding the event code back to isolate the
problem. You can also send a simple example I can run here to
support@digital-metaphors.com in .zip format and I'll take a look at it.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Thanks Nico, I'll try to get back to this later this week and see if I can
figure out what's going on exactly.