Hi,
I am using the below code to disable the parameter prompts while opening the crystal reports:
ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
IEnterpriseSession enterpriseSession = mySessionMgr.logon(userID, password, CMS,auth);
if (enterpriseSession != null)
{
IInfoStore iStore = (IInfoStore)enterpriseSession.getService("InfoStore");
final String query = "SELECT SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE " +
"SI_NAME like '%Average Number of Users Logged In%' and SI_KIND='CrystalReport'";
IInfoObjects objInfoObjectsWIDs = (IInfoObjects) iStore.query(query);
IInfoObject objInfoObjectWID = (IInfoObject) objInfoObjectsWIDs.get(0);
int docId = objInfoObjectWID.getID();
int parentId = objInfoObjectWID.getParentID();
IReportAppFactory reportAppFactory = (IReportAppFactory)enterpriseSession.getService("RASReportFactory");
ReportClientDocument rcd = reportAppFactory.openDocument(docId,OpenReportOptions._openAsReadOnly ,java.util.Locale.US);
Fields fields = rcd.getDataDefController().getDataDefinition().getParameterFields();
ParameterField paramField ;
for (int count=0;count<fields.size();count++)
{
paramField = (ParameterField) fields.getField(count);
paramField.getCurrentValues().removeAllElements();
}
PrintOutputController outputController = rcd.getPrintOutputController();
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) outputController.export(ReportExportFormat.MSExcel);
byte[] byteArray = new byte[byteArrayInputStream.available()];
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
l_fos = new FileOutputStream("D:\\_workarea\\MORCOM_POC\\reports\\"+fileName);
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(l_fos);
}
But I am getting the following error:
com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Missing parameter values.---- Error code:-2147217394 Error code name:missingParameterValueError
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at BOTest.main(BOTest.java:86)
at line:
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream) outputController.export(ReportExportFormat.MSExcel);
Please suggest what is missing out here.
If there is some other way to disable prompts in Crystal Reports, please provide insight to that also
I am using Crystal Reports that comes with BO XI R3 version.
Thanks
Shruti