Saving and Exporting Data with Dynamic Queries


(Run Example)

(View Sources - first page  the called page  printer  save as file   export to excel   save bookmark   list bookmark )

Data Requirement

This example requires installation of either the IBM DB2 UDB, Oracle, MS-SQL or Sybase version of QCC 2003 database.

  1. The sample data can be found in the installation CD under sampledata/qcc/acs. Follow the instruction in the readme.txt file in the version of QCC 2003 you want to install.
  2. Define this data source to DB2 Alphablox with the data source name set to qcc2003-rdb.

Reusing the Example

To reuse this example for your own application, there are three variables in the file.jsp page that you will need to modify based on your application. These are used to specify where these JSP files are in relation to your application root, where the static report should be saved on the server, and where the referenced stylesheets are.

Techniques Demonstrated

This example demonstrates a variety of functionality available in Relational Reporting. It demonstrates:

While this example demonstrates these various capabilities, in order to keep it simple for the purpose of learning, there are areas where the demonstrated functionality could be further enhanced. For example:

  • The file saving feature can be modified to prompt users for a file name. Currently it always saves the report as qcc.html in the savedreports/ subdirectory.
  • The static HTML file saved preserves the added HTML code and, if there are JavaScript or links, they do not work properly when the file is loaded.

These can be further enhanced by doing additional processing before saving/exporting the report data. The excel.jsp and textBloxUtils.jsp (for the export to Excel option) demonstrate how to remove the extra HTML code for a cleaner export.

Dynamically Setting Queries

This is done by using the following techniques:


(Run Example)

 
(View Sources - first page  the called page  printer  save as file   export to excel   save bookmark   list bookmark )