In a report application with input parameters, users often need to inquire some records
, and each user often use same inquiry conditions. Therefore, it will be very convenient for users if their inquiry conditions can be saved.
To realize this wonderful function, problems below need to be solved first:
(1) Relate to user.
Each user's inquiry conditions should be saved only for oneself, and others should be unable to refer to them.
(2) Relate to report module and inquiry module.
That's because under different report module or inquiry module, user's inquiry conditions are different.
(3) Storage format.
As the number and names of parameters are different in different modules, the storage format of inquiry condition must be flexible.
(4) Storage location.
For inquiry condition is related to user, the direct idea is to save it with cookies. However, as user may inquire on different computers, it isn't perfect. Therefore, the best method is to save inquiry conditions on server.
(5) Interface design.
The parameter input interface should provide a drop-down box which fetches saved inquiry conditions from server. Besides, an option is needed to decide whether to save current inquiry conditions. If user chooses to save, it should provide an edit box for storage name.
(6) Server-side programs.
First, it should decide to use saved inquiry conditions or current inquiry conditions according to browser-side input. To use saved inquiry conditions, it has to fetch them from database. To use current inquiry conditions, it needs to deal with the storage of them.
As every module is different, the commonality of the function must be strong. Or else, programmers have to realize the function for each module one by one. The workload is horrible!
From above problems, it is very easy to find the complexness of the function.
Fortunately, with the Parameter Template
and Parameter Handler Class
of RAQ Report
, users can realize the function of saving inquiry conditions much faster and easier.
1. Design a parameter template with three more parameters: Whether to save, saveName, and listSave.
2. Design a parameter table for the parameter handler class. When input parameters needs to be saved, the parameter handler class saves them in the designed parameter table which contains userName, reportName, saveName, argName and saveValue. The SQL statements are as follows:
CREATE TABLE param (
userName varchar(100) not null ,
reportName varchar(100) not null ,
saveName varchar(100) not null,
argName varchar(100) not null,
saveValue varchar(200) )
Then, user can visit the parameter template. If he selects saved parameter value for inquiry, it will be fetched from database in parameter handler class. Also, he is allowed to input new parameter for inquiry and choose whether to save the newly inputted parameter.
This post is from freezea's blog. You are welcomed cc it anywhere, and please indicate the source.
If you would like to read more articles about reporting tool, you are also welcome to refer to my blog