cancel
Showing results for 
Search instead for 
Did you mean: 

JRC CR XI Rel 2 - Invalid Parameter Name: {0} using Stored Proc in Oracle

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Are you suggesting to wrap it in the String class first?

Is that the difference in code?

This is actually how I've passed it in in the first place, but I'm getting the same error.

Do I have to register the in/out parameter somehow?

Former Member
0 Kudos

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.

Answers (1)

Answers (1)

Former Member
0 Kudos

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?