Cached Query Results
By default, when you run a report, Logi JReport Engine fetches data from the database using the JDBC driver. For reports that are built on queries (and also imported SQL files, stored procedures and user defined data sources), Logi JReport Designer enables you to create cached result files and save them somewhere in your machine. Then, when you view these reports, you can choose to use the data from the cached query result file as opposed to the database. This is very useful for working on the design of a report while you are off-line and do not have a DBMS connection. Additionally, it is helpful when you need to send data and reports to Jinfonet Support for assistance.
Below is a list of the sections covered in this topic:
Creating a Cached Query Result for a Query
Logi JReport Designer provides you with two ways to create cached query results, the first is with the Catalog Manager and the second is with the Data panel.
- Creating a cached query result file in the Catalog Manager
- In the Catalog Manager, select the query for which you intend to create the cached query result file.
- Right-click the query, and select Create Cached Query Result from the shortcut menu.
- In the Save Cached Query Result dialog, specify the file name with or without an extension and the folder where you want to save the result file. It is recommended to use an extension such as .cqr to help you identify the files. Logi JReport does not provide a default extension.
- Select Save and the cached query result file will be saved to the specified folder.
- Creating a cached query result file in the Data panel (available to page reports only)
- In the Data panel, right-click the query on which the report is built and select Create Cached Query Result from the shortcut menu.
- In the Save Cached Query Result dialog, specify the file name with or without an extension and the folder where you want to save the result file and then select Save.
Then, you can set the Data Driver property on the dataset created from the query appropriately in the Report Inspector to make a report run using cached query result.
Note: If you check the option "Use cached query result" in the Catalog category of the Options dialog, whenever you view a report in Logi JReport Designer, a dialog will prompt you to choose a cached query result to run the report.
Managing Cached Query Results
When specifying the Data Driver property for a dataset, you may find it inconvenient to input a property value that is long and complicated. To help you with this, Logi JReport Designer provides a tool for managing your cached query results, the Data Source Drivers.
Assume that a cached query result file orderstat_cached for the query OrderStat in the catalog file SampleReports.cat has been created and saved in C:\Logi JReport\Designer\Cached
. To use the Data Source Drivers, follow the steps below:
- Open the catalog file SampleReports.cat in
C:\Logi JReport\Designer\Demo\Reports\SampleReports
. - In the Catalog Manager, select Data Source Drivers on the toolbar. The Data Source Drivers dialog appears.
All the added drivers will be listed in the Data Source Drivers box. If you want to remove a driver, select the driver and select the Remove button. To edit a driver, select the driver and select the Edit button.
- Select the New button, and the Data Source Editor appears.
- Enter a name for the driver in the Driver Name box. Here, we name it OrderStat.
- Check the URL radio button and input the URL as follows:
jrquery:/jet.universe.resultfile.UResultFileResultSet;Fullpath_of_cached_query_result
In the example, the URL is
jrquery:/jet.universe.resultfile.UResultFileResultSet;C:\Logi JReport\Designer\Cached\orderstat_cached
Note: If you check the Driver radio button to specify the driver, you will need to input the class name and parameter of the driver as follows:- Class Name: jet.universe.resultfile.UResultFileResultSet
- Parameter: Full path of the cached query result (
C:\Logi JReport\Designer\Cached\orderstat_cached
in this example)
Then, a URL will be generated according to your input information.
- Select OK to add the driver.
- Select OK in the Data Source Drivers dialog to close it.
- Now you can choose the driver from the Data Driver property's drop-down list directly without inputting the long value manually.