Java Crystal Report SDK - Report & SubReport

泪湿孤枕 提交于 2019-12-24 00:25:08

问题


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:


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 !



来源:https://stackoverflow.com/questions/13602963/java-crystal-report-sdk-report-subreport

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!