KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Loading dataStores #2880

Open Richb201 opened this topic on on Nov 22, 2022 - 3 comments

Richb201 commented on Nov 22, 2022

I have a bunch of tables that I create before loading the dataStores. After this, I can drop the tables I created and I have found that the dataStores still work. I'd like to load up the datastores for a 2nd report from the first report. How can I do this? Do I need to display the 2nd report?

Sebastian Morales commented on Nov 23, 2022

We have ReportDataSource which might help:

https://www.koolreport.com/docs/datasources/reportdatasource/

Richb201 commented on Nov 23, 2022

Perhaps I didn't explain correctly. I want to load a report's datastores without displaying the report. Here is how it works: 1) user runs and displays the main report. To do this KR creates a bunch of datasources. 2) user can chose a link on the report to view a subreport. The subreport opens its own datasources, and then displays its report. 3) a user can chose from the main report to download a few additional reports.

Issue: I create about 10 small tables for the main report. The main reports datastores are created from these. When the user logs off, my app drops the left over small tables. BUT, if a user X's out of the app instead of pressing logoff, the small tables get left on my database server. This causes the speed of the app to slow down considerably.

Through trial and error I found that I can delete the small tables, and the main report still works. Why? I assume that the datastores don't get destroyed until a user reboots the pc? So this works great for the main report, but what about the sub reports.

I'd like to create the datastores for all reports in a function in the Model and immediately drop the small tables right after that. Where are the datastores stored in memory?

Sebastian Morales commented on Nov 24, 2022

Unless you use cache, every time your reports are run they will query the tables. The datastores are no longer in memory after servers response to a request. If you automatically created the temporary tables at the beginning it would explain deleting them immediately later doesn't affect the reports. I think you should log the sql queries in both PHP and your database to see when they are executed.

As for user closing browser instead of logging out you could set up a script running periodically (such as cron jobs in Linux, schedule tasks in Windows) to clean temporary tables when current time - a user's last action > session timeout.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None