Skip to Content
0
Former Member
Jun 18, 2010 at 06:13 AM

how to pass DATE parameter to crystal reports using java

208 Views

Hi,

Tech: Crystal reports server XI R2.

I have a crystal report with date input parameter and the code is below:

IInfoObjects reports = infoStore.query("Select SI_PROCESSINFO.SI_PROMPTS "

+ "From CI_INFOOBJECTS Where SI_ID = " + multiClientReport.getID() );

if(reports.size()==0)

{

logger.severe("Report does not exist.");

}

IInfoObject report = (IInfoObject) reports.get(0);

List allParameters = ((IReport) report).getReportParameters();

logger.severe("Parameters size:" + allParameters.size());

IReportParameterSingleValue newParameter = null;

IReportParameter reportParameter = null;

reportParameter = (IReportParameter) allParameters.get(l);

reportParameter.getCurrentValues().clear();

newParameter = reportParameter.getCurrentValues().addSingleValue();

newParameter.setValue(Date.valueOf("2010-01-01").toLocaleString());

The above line is giving below error:

java.lang.IllegalArgumentException: Invalid argument type

at com.crystaldecisions.sdk.plugin.desktop.common.internal.y.setValue(Unknown Source)

at com.hms.MCOReports.scheduleReport(MCOReports.java:133)

at com.hms.MCOReports.run(MCOReports.java:48)

at com.crystaldecisions.sdk.plugin.desktop.program.internal.ProgramWrapper.main(Unknown Source)

Exception in thread "main"

Please let me know how to pass date parameter to crystal reports.

Thanks,

Vijay Kanth