Dear Experts,
I have developed a tool with java sdk to schedule the webi reports in BI 4.1, i am facing an issue when scheduling the Crystal report reports when DB connection is enabled .
Please help us the how to schedule the crystal report using SDK when the crystal report is enabled DB connection..
Please find the below source code for scheduling Crystal report.
String reportId = reportDetailsVO.getReport_Id(); enterpriseSession = SDKConnectionUtils .loginToCms(enterpriseSession); IInfoStore infoStore = null; IInfoObjects oInfoObjects = null; String query = "Select TOP 1 * From CI_INFOOBJECTS Where " + " SI_KIND='CrystalReport' And SI_INSTANCE=0 " + " And SI_ID = '" + reportId + "'"; /* * webiReportEngine = (ReportEngine) enterpriseSession * .getService("WebiReportEngine"); */ infoStore = (IInfoStore) enterpriseSession .getService("InfoStore"); oInfoObjects = infoStore.query(query); IInfoObject report = (IInfoObject) oInfoObjects.get(0); // CONTRACT_NUM; Map<String, String> promptAndValues = null; promptAndValues = new HashMap<String, String>(); if (reportDetailsVO.getReportPromptsNames() != null) { String reportParamNames = reportDetailsVO .getReportPromptsNames() + ";"; String[] reportParamNamesArray = reportParamNames .split(";"); String reportParamValues = reportDetailsVO .getReportPromptsValues() + ";"; String[] reportParamValuesArray = reportParamValues .split(";"); for (int i = 0; i < reportParamNamesArray.length && reportParamValuesArray[i].length() > 0; i++) { promptAndValues.put( reportParamNamesArray[i].toString(), reportParamValuesArray[i].toString()); } } /* *//** * * p_Monat p_Region p_Filiale */ /* * * Map<String, String> promptAndValues = null; promptAndValues = * new HashMap<String, String>(); promptAndValues.put("p_Jahr", * "2015"); promptAndValues.put("p_Monat", "03"); * promptAndValues.put("p_Region", "12"); * * promptAndValues.put("p_Filiale", "0"); */ for (int i = 0; i < ((IReport) report).getReportParameters() .size(); i++) { IReportParameter reportParameter = (IReportParameter) ((IReport) report) .getReportParameters().get(i); if (reportParameter.isDiscreteValueSupported()) { IReportParameterValues parameterValue = reportParameter .getCurrentValues(); IReportParameterSingleValue discreteValue = parameterValue .addSingleValue(); discreteValue.setValue(promptAndValues .get(reportParameter.getParameterName())); } } if (report.getProcessingInfo().properties() != null) { IProperties boProcessingInfo = (IProperties) report .getProcessingInfo().properties(); IProperties siPrompts = (IProperties) boProcessingInfo .getProperty("SI_PROMPTS").getValue(); int numberPrompts = ((Integer) siPrompts.getProperty( "SI_NUM_PROMPTS").getValue()).intValue(); for (int i = 1; i <= numberPrompts; i++) { try { IProperties prompt = (IProperties) siPrompts .getProperty("SI_PROMPT" + i).getValue(); String promptName = prompt.getProperty("SI_NAME") .getValue().toString(); System.out.println("promptName CrystalReport:" + promptName); System.out .println("promptAndValues.get(promptName):" + promptAndValues.get(promptName)); } catch (Exception e) { e.printStackTrace(); } } } ISchedulingInfo scheduleInfo = report.getSchedulingInfo(); scheduleInfo.setType(CeScheduleType.ONCE); scheduleInfo.setRightNow(true); IReportFormatOptions reportFormatOptions = ((IReport) report) .getReportFormatOptions(); reportFormatOptions .setFormat(IReportFormatOptions.CeReportFormat.CRYSTAL_REPORT); IInfoObjects objectsToSchedule = infoStore .newInfoObjectCollection(); objectsToSchedule.add(report); infoStore.schedule(objectsToSchedule); System.out.println("Instance Generation for crystal called successfully");
Regards,
Durga
Have you looked at the scheduling sample code that's available here: Java BusinessObjects Enterprise SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki. In particular, you should look at the code for Java_Enterprise_BE115_schedule_report_dblogon
I know that it's for earlier versions of BO, but, unlike Webi, the Crystal scheduling code hasn't really changed since BO 3.1 unless your reports were written in Crystal for Enterprise, in which case you can use the RESTful Web Services to schedule. However, the RESTful Web Services won't allow you to access parameters and database information for reports that were written in "classic" Crystal (Crystal 2011, 2013, 2016, etc.)
-Dell
Message was edited by: Dell Stinnett-Christy
Add a comment