Mikolaj
Mikolaj

Reputation: 190

Java Crystal Report SDK - Report & SubReport

I'm trying to generate a report using Crystal Report SDK in Java composed by a main report and a subreport.

I do want to generate the report only if there is something returns by my stored procedure and for doing that I execute the proc manually and launch the report generation only if my ResultSet != null.

But, my subreport has to be generated through Crystal.

_ I use the setTableslocation() for getting the values and generating the report through crystal

_ I set all the parameters needed in the ParameterFieldController of my subreport.

However, I'm getting this error in my console :

Missing parameter values.---- Error code:-2147217394 Error code name:missingParameterValueError

Even though the subreport's parameters are correctly setted.

If I generate my report with no subreport or with report and no needed parameter, the generation is just fine.

Am I setting my parameters in a wrong way ?

Upvotes: 2

Views: 2097

Answers (1)

Mikolaj
Mikolaj

Reputation: 190

After trying a lot of stuff for integrating my subreport without using another ResultSet, here is the way for setting the parameters for the subreport :

You have to use the ParameterFieldController of the main report and not the one of the subreport... Logic.

ParameterFieldController paramFieldController = rptClientDoc.getDataDefController().getParameterFieldController(); paramFieldController.setCurrentValue(subreport_name, parameter_name, parameter_value);

And now, it works just fine !

Upvotes: 2

Related Questions