Releasing the Designer
D7 RB7.01 Interbase
This is what I am doing :-
I have various Report Selection dialogs in my app. Then according to which
report they select there is
Delphi code to query interbase database according to their selections etc
Batch move records from query into a table (batCopy) in the database which
is then accessed in a query in the DataView of the report. nb No pipeline on
the form referring to the table. ( I do this becuase my users can then link
easily other queries as they choose, to the data which is not so easy with
a pipeline on the form)
My problem is :-
If I select the same report twice I get an error message when the BatchMove
executes (the second time) saying it cannot drop the table because it is in
use.
I know that it is not in use by my app because I never open it and I call
close immediately before the BatchMove just in case that opens it.
I know that this is something to do with the TppReport still having the
table open because if I select another report and then go back to the first
one I don't get the error. Neither do I get it if I customise the report and
then print it or preview it. But 2 previews in a row, or prints in a row of
the same report generates the error.
I have tried ppReport.New to clear the template but this hasn't had any
effect. If I close the form that the TppReport component form is on I don't
get the problem either.
Grateful for any suggestions here as telling my users to close the Report
Selection dialog in my app is wearing a bit thin!
Rhonda Ridge
This is what I am doing :-
I have various Report Selection dialogs in my app. Then according to which
report they select there is
Delphi code to query interbase database according to their selections etc
Batch move records from query into a table (batCopy) in the database which
is then accessed in a query in the DataView of the report. nb No pipeline on
the form referring to the table. ( I do this becuase my users can then link
easily other queries as they choose, to the data which is not so easy with
a pipeline on the form)
My problem is :-
If I select the same report twice I get an error message when the BatchMove
executes (the second time) saying it cannot drop the table because it is in
use.
I know that it is not in use by my app because I never open it and I call
close immediately before the BatchMove just in case that opens it.
I know that this is something to do with the TppReport still having the
table open because if I select another report and then go back to the first
one I don't get the error. Neither do I get it if I customise the report and
then print it or preview it. But 2 previews in a row, or prints in a row of
the same report generates the error.
I have tried ppReport.New to clear the template but this hasn't had any
effect. If I close the form that the TppReport component form is on I don't
get the problem either.
Grateful for any suggestions here as telling my users to close the Report
Selection dialog in my app is wearing a bit thin!
Rhonda Ridge
This discussion has been closed.
Comments
Are you able to recreate this issue just using ReportBuilder, without any of
your code? If so, please provide the exact steps you took to get the error.
As a quick test I placed two report components on a form and printed both of
them in sequential order having each of them access the same table using a
dataview in DADE. This seemed to work flawlessly. If you would like, you
can send an example of this behavior to support@digital-metaphors.com and
I'll take a look at it for you.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
the table and pumps data into it before the report runs. I am using one
report component and am loading the report from a template (ie an rtm file).
Different files do not cause the problem but the same file run twice does.
To summarise the process is as follows
1.User selects report.
2.Queries and batch moves execute. (Batch move uses batCopy which issues an
SQL command to drop the table first, and
then recreates it and moves the data from the query into it.)
3. RTM file is loaded into rport component
4. report is printed or previewed.
This works fine the first time.
If the same report ie same rtm file is selected the process starts again but
fails at 2 because the table used to hold the data is in use by the report
component even though it has closed, finished etc.
If a different report ie rtm file is selected and then the first one
reselected there is no problem, (nb each different report selection uses a
different table to store its results in) or if the same report is customised
using a Designer component and then printed or previewed no problem.
It is a though the report component keeps the table open even though it is
opened in the dataview and not on the form.
If the form containing the report component is closed between the 2 attempts
there is no problem. I have tried waiting 10 minutes in case I was doing it
too quickly and to give the report component time to close the table but
this makes no difference.
Thanks for your help.
Once a table is opened in your database, ie. when you load a template with
dataviews, it will remain open, even if you close the report, and change
templates. To work around this issue, try calling Report.FreeModules rather
than Report.Template.New. This will remove all dataviews from the data
workspace and hopefully let you do a Batch Move.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com