refreshing the dataset returned by report query during runtime
I'm using a query to generate the report. The query is within the report
itself under "Data" tab.
The report works fine when I excute it for the 1st time but it's not
updating or refreshing its data if I run it again after altering my data.
How can I rerun the built in Report Builder query during run time to refresh
my data?
Thank you,
-Halim
itself under "Data" tab.
The report works fine when I excute it for the 1st time but it's not
updating or refreshing its data if I run it again after altering my data.
How can I rerun the built in Report Builder query during run time to refresh
my data?
Thank you,
-Halim
This discussion has been closed.
Comments
Try clearing the MetaData Cache. If you are using the end-user designer and
simply changing the query being used, the report will honor those changes
when it is regenerated. (This works as expected in my testing).
----------------------------------------
Tech Tip: Clearing the Meta Data Cache
----------------------------------------
There is a global meta data cache that the ReportBuilder uses to cache
information about the available database tables and fields. You can clear
the meta data cache using the following code.
uses
daMetaDataManager;
begin
gMetaDataManager.Clear;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I tried gMetaDataManager.Clear but it didn't work. Not sure whether I am
using it right or not. It seems like I can't re run the same query to
refresh my data.
The report is created in Delphi IDE. I use a data session where I create the
query for the report. I don't need a DBPipeline in this case.
I start the software then I run the report. It looks fine at first run.
Let's assume my report has the list of customers in my DB.
if I add a new customer to my database then run the report again, the last
inserted customer will be missing from the report. I have to restart the
software all over again to get it to show on the report.
I hope my example helps explaining my issue.
Thank you,
-Halim
Yes, sorry, the MetaData Cache will not help in this case.
1. You need to be sure the new record is actually being committed to your
database. This will most likely involve closing the query, adding the
record, then reopening the query again.
2. When you say you "run the report again", are you completely closing the
report, then regenerating it or simply moving to the design tab and back to
the preview tab? You will probably need to shut the report down completely
before updating the database for the changes to be recognized.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
through the program by calling "Report.Print".
In my testing, opening a report, closing the report and dataset, adding a
field to a Table, then re-opening the report works successfully. Be sure
you are completely closing the dataset the report is connected to before
committing the new record to the database.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com