Skip to Content
author's profile photo Former Member
Former Member

IInfoObjects .add throws UnsupportedOperationException

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?

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Dec 15, 2011 at 02:01 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2011 at 10:03 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.