Java Crystal Report SDK - Report & SubReport

2019-07-07 12:58发布

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 setTablesDatasource() method for my main report for using my ResultSet
  • For my subreport:

_ 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 ?

1条回答
神经病院院长
2楼-- · 2019-07-07 13:23

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 !

查看更多
登录 后发表回答