Differences When Viewing a Report with Preview vs. Running The Report
Hello All!
I am using version 10.03 rel 2 and I am seeing something that is puzzling
me.
I have a report in which I have a "variable" component. Within the "OnCalc"
event
of the "variable" component, I have placed a "ShowMessage". When I run the
report
via "Preview", I see the "ShowMessage". However, when I run the report from
my app,
the "ShowMessage" never comes up.
Can anyone explain to me why I may not be seeing the "ShowMessage" when I
run my
report from the app? Also, is there any chance that the OnCalc even won't
fire when
running my report while NOT previewing it?
Thanks in advance for info that you can provide!
Regards,
Everett
I am using version 10.03 rel 2 and I am seeing something that is puzzling
me.
I have a report in which I have a "variable" component. Within the "OnCalc"
event
of the "variable" component, I have placed a "ShowMessage". When I run the
report
via "Preview", I see the "ShowMessage". However, when I run the report from
my app,
the "ShowMessage" never comes up.
Can anyone explain to me why I may not be seeing the "ShowMessage" when I
run my
report from the app? Also, is there any chance that the OnCalc even won't
fire when
running my report while NOT previewing it?
Thanks in advance for info that you can provide!
Regards,
Everett
This discussion has been closed.
Comments
The OnCalc event should fire regardless. Are you by chance loading a
template in your application? If so, you may be loosing the event handler.
Take a look at the following article for more information.
--------------------------------------------
Article: Troubleshooting Lost Event Handlers
--------------------------------------------
Let's assume you have created a report in Delphi and assign an event
handlers to the OnPreviewFormCreate event of the report. The event is
generated by Delphi as:
procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
You then save the report to an RTM file 'Report1.RTM.' The events are
stored as references only, and so the RTM contains:
object ppReport1: TppReport
.
.
OnPreviewFormCreate = ppReport1PreviewFormCreate
end
You then go on to work on a different report. Saving it with under then
name 'Report2.RTM'. Only this time, before you save the report you change
the report component name to: rptOrders. Delphi automatically updates the
event declaration for OnPreviewFormCreate event to:
procedure TForm1.rptOrdersPreviewFormCreate(Sender: TObject);
You then create two buttons on the form, one to load Report1 and preview,
the other to load Report2 and preview. When you run the app and click
Report1, you an error. This is because the Report1.RTM file
contains a reference to ppReport1PreviewFormCreate, a method which no longer
exists (at least with this name) in the form.
One answer is to load all your rtm files into the report component you will
be using for loading. Fix any errors, reassign any events that get cleared.
This will update your rtms to contain the proper event handler names.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I finally did see it work as desired. As it turns out, the "ShowMessage"
was not being shown until I actually changed the Page. Once I did that,
I saw the event fire for every detail record on the page.
Again, thanks, we can put this issue to rest.
Regards,
Everett