cancel
Showing results for 
Search instead for 
Did you mean: 

CR 2011 - JDBC Report Issue in passing parameters

Former Member
0 Kudos

We built a cross tab report on CR 2011 that accept two parameters [integer and date] and the data is coming from a stored procedure on SQL Server. The connection is of the type JDBC.

Irrespective of the parameters passed, I get the data displayed on the UI which is supplied at the design time. i.e . the data that is entered when refreshing the report view from Crystal 2011 IDE.

The java code that is passing the parameters is generated by Eclipse using the latest library provided. The code snippet that is attaching the parameters are given below. The rpt file, is a simple report that accepts two parameters - Int and datetime.

These two parameters match in Name (with case) and datatype with the underlying stored procedure.

What ever are the parameters supplied the displayed report is always for '10/30/2005' and PaId of 1 are the parameters that were supplied when saving the rpt file.

The stored procedure code is,

Create Proc ZRGDTest (@PaID int, @AsOfDate datetime) as

begin

Select * from SpecialitiesPa where asofdate=@AsOfDate and Pa_Id=@PaID and status=4

end

The Java code snippet that attaches parameters is,

String reportName = "FullPathZRGDTest.rpt";

ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

if (clientDoc == null) {

// Report can be opened from the relative location specified in the CRConfig.xml, or the report location

// tag can be removed to open the reports as Java resources or using an absolute path

// (absolute path not recommended for Web applications).

clientDoc = new ReportClientDocument();

clientDoc.setReportAppServer(ReportClientDocument.inprocConnectionString);

// Open report

clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);

CRJavaHelper.logonDataSource(clientDoc, "sa", "sapwd");

// ****** BEGIN CONNECT PARAMETERS SNIPPET ****************

{

// NUMBER VALUE PARAMETER.

Integer numberValue = new Integer(6); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "@PaID", numberValue);

}

{

// DATE-TIME VALUE PARAMETER.

Calendar calendar = Calendar.getInstance();

calendar.set(2010, 5, 30, 0, 0, 0);

Date dateTimeParamVal = calendar.getTime(); // TODO: Fill in value

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "@AsOfDate", dateTimeParamVal);

}

// ****** END CONNECT PARAMETERS SNIPPET ****************

// Store the report document in session

session.setAttribute(reportName, clientDoc);

Environment:

Eclipse : Helios

Java : 1.6.21

CR: Crystal Report 2011

CR - SDK : Version 2 latest available at SDN.

OS : XP

App/Web Server glassfish 3.0

Can any one point out what is the issue and how this can be solved ?

TIA

DRG

Edited by: drgiri on Sep 16, 2011 10:59 AM

Edited by: drgiri on Sep 16, 2011 11:00 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Raghavan,

this issue has be resolved in Crystal Reports for Eclipse SP13 which is available at the following location. Please give it a try and confirm that it resolves the issue.

http://www.businessobjects.com/campaigns/forms/downloads/crystal/eclipse/datasave.asp

thanks

James