No object with this name found
Hi,
I have 2 TppReport components (let's call then Report1 and Report2) with
their own data pipelines, datasources and even database connections. I
load the report templates at runtime.
When I run Report1 first it works fine but Report2 fails on the
Report2.Template.LoadFromFile call with an error "... BeforeGenerate
code for GroupFooterBand1, no object with this name found". When I
re-run the application and run Report2 first it works 100% but Report1
fails with the same problem. "GroupFooterBand1" in the above error
string is representative of the errors I get. I get the error for each
group header and footer band in the report. The detail band works fine
and data comes through fine. It depends which report runs first whether
it executes correctly.
I suspect it has something to do with the pipelines in DADE. The events
have code that references the pipelines.
Any ideas?
I use Delphi 5 with Report Builder 6.
Thanks,
Gerhard
I have 2 TppReport components (let's call then Report1 and Report2) with
their own data pipelines, datasources and even database connections. I
load the report templates at runtime.
When I run Report1 first it works fine but Report2 fails on the
Report2.Template.LoadFromFile call with an error "... BeforeGenerate
code for GroupFooterBand1, no object with this name found". When I
re-run the application and run Report2 first it works 100% but Report1
fails with the same problem. "GroupFooterBand1" in the above error
string is representative of the errors I get. I get the error for each
group header and footer band in the report. The detail band works fine
and data comes through fine. It depends which report runs first whether
it executes correctly.
I suspect it has something to do with the pipelines in DADE. The events
have code that references the pipelines.
Any ideas?
I use Delphi 5 with Report Builder 6.
Thanks,
Gerhard
This discussion has been closed.
Comments
You are most likely seeing this error because both reports are trying to
access the same event code in your application. Be sure that the bands and
events all have unique names for each report so they do not interfere with
each other when both reports are loaded at the same time.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico,
I don't have any event code that the reports share. When you say
"...when both reports are loaded at the same time." do you mean
concurrently? They can't run concurrently, you run the first one, close
it and then run the second one.
The two reports are totally separate from each other. As I mentioned in
my original post they are separate from database the connection through
to data pipeline and the ppReport component.
Is there anything in the report engine that I have to/can clear maybe
before the second report runs - global memory or something?
Sorry, I initially missunderstood what your application was doing. I still
however believe there is a conflict with the naming of the groups and group
components that is causing this issue. For later versions of ReportBuilder
we enhanced the template object to handle this more gracefully. My first
suggestion would be to download a trial copy of RB 7.04 for Delphi 5 and
test your application with that. Another option would be to use a single
report object and a single database connection and load your templates one
after the other before printing. This can still cause naming issues due to
the difference in the report names.
The only sure fire way to solve this problem would be to move all your event
code inside the template file using RAP. This keeps all event code local to
the template so there is no chance of any conflicts.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico,
Unfortunately RB 7 is not an option for us. Major development on the
application in question here has been halted since we are busy migrating
all our reports to a web based system. It'll be a while till we release
our web reports so we thought we'd "quickly" do 2 new reports for one of
our clients in the old system but as Murphy would have it, it didn't
turn out to be that quick.
Anyway, almost all event code sits in the templates. In fact only 2
events namely "DetailAfterGenerateEvent" and "SummaryBeforeGenerate" are
coded in the application. In my original post I talked of Report1 and
Report2 as if they were the only two reports. In actual fact they are
representative of two GROUPS of reports with 18 original reports
belonging to Group 1 and 2 new reports belonging to Group 2. It is the
running of a report from the other group after a report was run from
this group that causes the problems.
Running any report in a particular group in a session of the application
works 100%. It is when reports from both groups are run in the same
session that the error occurs and then only for the reports in the other
group than the report that was run first.
Group 1 uses the same "DetailAfterGenerateEvent" and
"SummaryBeforeGenerate" code in the application and Group 2 use only
"DetailAfterGenerateEvent" BUT not the same one as Group 1.
If I can't fix this easily (remember - no serious development) I have
two possible "solutions". One is to get the client to run two instances
of the application and to stick to reports in the group for each
instance. Two is to take out the new reports and put them in their own
application. I don't like either one, but this is temporary and maybe we
can dangle the carrot of the new web reports to make the customer happy...
What is kept in memory by the report engine after the first report has
run? Can't I clear this (and how) every time a report runs - even at the
cost of performance?
Sorry for the long post!
Thanks,
Gerhard
As a test, try creating an empty report template (place a report on a form,
open it and save the template). Now before any report template is loaded,
be sure the other report object contains the empty template. For instance,
if the user loads a template in Report1, load the empty temlate into Report2
first, then load Report1. Same for the other report object. If this is a
naming conflict, keeping an empty template loaded in one of the reports
should solve the problem.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com