Skip to Content
author's profile photo Former Member
Former Member

JSP/WebViewer - set parameter values to display in Parameter dialog as suggest

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);

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 21, 2014 at 01:30 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dell,

      thank you very much for your response - that's what i was suspecting. I will probably go for doing my own dialog - we tried to avoid that because of the time this will take, but - that's life 😉

      Regards, Claudia

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.