on 09-10-2008 3:21 AM
Hello,
I've been stumped by this issue that I've been getting. I've been trying to take advantage of stored procs to filter the result set before returning to CR instead of using views, which relies on most of its filtering on the crystal reports side.
I've followed the process of creating the strongly bound cursor, then including an "in out" parameter along with 5 other "in" parameters in the stored proc. In the Java class, this is how I pass in the parameters:
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(REPORT_NAME, 0);
//Connection setup
ConnectionService.getInstance().crytalReportsConnectionSetup(reportClientDoc.getDatabaseController());
//We will be using the ParameterFieldController
ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();
paramFieldController.setCurrentValue("", "PARAM1", "000");
paramFieldController.setCurrentValue("", "PARAM2", "000");
paramFieldController.setCurrentValue("", "PARAM3", "000");
paramFieldController.setCurrentValue("", "PARAM4", "000");
paramFieldController.setCurrentValue("", "PARAM5", "000");
I end up getting an error:
Invalid Parameter Name:
I've tested the report itself in Crystal and it works. Is there something I'm missing?
Thanks in advance,
Jeff
The message error simply means that the parameters values are not valids. It is a well-known message error we are likely to encounter when passing parameters' values at runtime.
Could you try something like this below? Which does not differ significantly of your code but it will be worth try it:
String reportName = "jrc_export_with_parameters/TestReport.rpt";
//Database credentials for the report's datasource.
final String USERNAME = "system";
final String PASSWORD = "mutcho";
try
{
//---------- Create a ReportClientDocument -------------
ReportClientDocument oReportClientDocument = new ReportClientDocument();
//---------- Set the path to the location of the report soruce -------------
//Open report.
oReportClientDocument.open(reportName, 0);
ParameterFieldController parameterFieldController = oReportClientDocument.getDataDefController().getParameterFieldController();
parameterFieldController.setCurrentValue("", "ID", new String("1"));
//set with the appropriate database logon credentials.
oReportClientDocument.getDatabaseController().logon(USERNAME, PASSWORD);
Cheers
Alphonse
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whether or how you wrap your parameters depends on what the type is in Crystal Reports. If it is indeed a number, something that works well is to create a number object (for example new Integer("2")) and pass it to the parameter.
The error you are experiencing however seems to be related to the parameter name; can you confirm that the names you are using exactly match the case, and everything, in Crystal Reports? For a stored procedure you may need to pre-pend the @ symbol to your parameter name.
I would also be interested in a solution to this problem. However, it's worth noting that it's probably not Oracle specific, since I'm calling a stored proc on Sybase and also get this error. All my parameters have been set (it complains differently if I don't), so what does this mean?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.