on 07-17-2014 10:11 AM
Hello, Community,
i'm struggling with the parameter dialog in the CrystalReportViewer.
I hope, i'm posting this question in the right place...
I'm developing a JSP application to display Reports. Parameter values are read from a database, when the report is opened, set to the viewer and saved to the database, when the user changes them in the viewer. This works fine.
But as soon as i set the parameter values programmatically to the viewer, the Parameter dialog is not showing up any more, and the report is opened immediately with these parameters. Instead, i would need to set the parameter values as suggest values, so the user can see and change them in the dialog.
I tried several approaches to set the values in a way to get this behavior with no success (it's more like guessing and not knowing, what i do).
Is it maybe possible to get the values from the database and save them in the report document somehow?
Any help would be appreciated! Thanks.
Here is the code where i set the parameter values to the fields:
List<ParameterInfo> results = queryBean.getReportParameters(reportName);
if (results == null || results.isEmpty()){
return;
}
String parameterName = "";
ParameterField paramField = null;
Values newValues = null;
// now map the parameter values to the parameter
for (ParameterInfo parameterBean : results){
// yet another value for the same parameter?
if (!parameterBean.getParameterName().equals(parameterName)){
newValues = new Values();
parameterName = parameterBean.getParameterName();
// get the next parameter field
paramField = getParameterField(parameterName, paramFields);
if (paramField != null){
paramField.setCurrentValues(newValues);
}
}
// set the parameter value from parameterBean to the value list
if (paramField != null){
addParameterValue(paramField.getType().value(), parameterBean, newValues);
}
}
// set the fields with the new values to the viewer
crViewer.setParameterFields(paramFields);
What you will probably have to do is create you're own dialog to allow the user to set the parameters. The only other way to set the default values for the parameters might be to run the report with your desired default values before saving it. The problem with this technique is that there is no way to dynamically set default date values based on the current date - but it might work for all other types of parameters.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.