on 12-15-2011 7:55 AM
Hi,
I try to use the IInfoStore schedule method for scheduling a report. It is a simple report with no paramters and forumulas.
But I receive an UnsupportedOperationException, when I try to add the IReport object into the IInfoObjects list.
I used the sdk scheduling example as template:
...
IReport report = (IReport) infoObject;
ISchedulingInfo scheduleInfo = report.getSchedulingInfo();
scheduleInfo.setType(CeScheduleType.ONCE);
scheduleInfo.setRightNow(true);
IReportFormatOptions reportFormatOptions = ((IReport) report).getReportFormatOptions();
reportFormatOptions.setFormat(IReportFormatOptions.CeReportFormat.PDF);
IInfoObjects objectsToSchedule = infostore.newInfoObjectCollection();
objectsToSchedule.add(report); // throws UnsupportedOperationException
infostore.schedule(objectsToSchedule);
Can anybody help?
Hi Toni,
For scheduling you can try using this code snippet
String query ="SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='CrystalReport' AND SI_INSTANCE=0 AND SI_Name='Report Name'";
IInfoObjects infoobjects =(IInfoObjects) infostore.query(query);
IInfoObject infoobject =(IInfoObject) infoobjects.get(0);
IReport reportObj=(IReport) infoobject;
ISchedulingInfo schedulinginfoObj=infoobject.getSchedulingInfo();
schedulinginfoObj.setRightNow(true);
schedulinginfoObj.setType(CeScheduleType.ONCE);
infostore.schedule(infoobjects);
Let me know if this was helpful.
Regards,
Prithvi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Toni,
Please try below sample code :-
try
{
ISessionMgr sm = CrystalEnterprise.getSessionMgr();
IEnterpriseSession enterpriseSession = sm.logon(username, password, CMS, Authen);
IInfoStore infostore = (IInfoStore)enterpriseSession.getService("InfoStore");
IInfoObjects infoObjects = infostore.query("Select SI_PROCESSINFO.SI_PROMPTS "
+ "From CI_INFOOBJECTS Where SI_KIND='CrystalReport' and "
+ "SI_NAME='World Sales Report' and SI_INSTANCE=0");
IInfoObject report = (IInfoObject) infoObjects.get(0);
ISchedulingInfo scheduleInfo = report.getSchedulingInfo();
scheduleInfo.setType(CeScheduleType.ONCE);
scheduleInfo.setRightNow(true);
IReportFormatOptions reportFormatOptions = ((IReport)report).getReportFormatOptions();
reportFormatOptions.setFormat(IReportFormatOptions.CeReportFormat.CRYSTAL_REPORT);
IReportPrinterOptions printerOptions = ((IReport)report).getReportPrinterOptions();
printerOptions.setCopies(1);
IInfoObjects objectsToSchedule = infostore.newInfoObjectCollection();
objectsToSchedule.add(report);
infostore.schedule(objectsToSchedule);
}
catch(Exception e)
{
out.println(e.getMessage());
}
Let me know if you need any information
Regards,
Rameez
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.