We help IT Professionals succeed at work.
Get Started

Pass Parameter Value to Crystal Report Subreport

Last Modified: 2013-11-15
I am using the CrystalReportViewers12 in my Apache Tomcat web-application. I have got the report to be fully functional and am even able to pass parameters to the Report. But when attempting to pass a parameter value to the sub-report I receive the following error:

ReportSDKParameterFieldException: Some parameters are missing values---- Error code:-2147217394 Error code name:missingParameterValueError.

I should mention that the parameter in the Sub-Report is linked to a field on the Main Report.

Here are the two methods I attempted to utilize to set the sub-report parameter value but to no avail.

//I know this method works for adding Parameter values to the main report
1. Fields parameterFields = new Fields();
ParameterField paramField = new ParameterField();
ParameterFieldDiscreteValue paramFieldDiscreteValue = new ParameterFieldDiscreteValue();
Values paramValues = new Values();


2. ReportClientDocument clientDoc  = new ReportClientDocument();
clientDoc.open("REPORT_NAME", OpenReportOptions._openAsReadOnly);

IStrings subNames = clientDoc.getSubreportController ().getSubreportNames ();
for (int subNum = 0; subNum < subNames.size (); subNum++)
    DataDefController dataDefController = clientDoc.getSubreportController().getSubreport(subNames.getString(subNum)).getDataDefController();

Fields paramFieldd = (Fields) dataDefController.getDataDefinition().getParameterFields();

    clientDoc.getDataDefController().getParameterFieldController().setCurrentValue(subNames.getString(subNum),paramFieldd.getField(subNum).getName(), 0);

At this point I'm a bit stuck and would appreciate any help.

Watch Question
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE